From 2b0a9b2faadd8ac3aa155461c2d2122d4f25e317 Mon Sep 17 00:00:00 2001 From: Jian Yuan Lee Date: Fri, 4 Aug 2023 21:34:31 +0100 Subject: [PATCH] fix typing --- .../integrations/github_enterprise/test_client.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/sentry/integrations/github_enterprise/test_client.py b/tests/sentry/integrations/github_enterprise/test_client.py index 2a57d33fe14e46..95c1bf9773b139 100644 --- a/tests/sentry/integrations/github_enterprise/test_client.py +++ b/tests/sentry/integrations/github_enterprise/test_client.py @@ -4,7 +4,7 @@ import pytest import responses -from sentry.integrations.mixins.repositories import RepositoryMixin +from sentry.integrations.github_enterprise.integration import GitHubEnterpriseIntegration from sentry.models import Repository from sentry.shared_integrations.exceptions import ApiError from sentry.testutils.cases import TestCase @@ -67,7 +67,8 @@ def setUp(self): integration_id=integration.id, ) self.install = integration.get_installation(organization_id=self.organization.id) - self.client = self.install.get_client() + assert isinstance(self.install, GitHubEnterpriseIntegration) + self.gh_client = self.install.get_client() responses.add( method=responses.POST, url=f"{self.base_url}/app/installations/install_id_1/access_tokens", @@ -88,8 +89,7 @@ def test_check_file(self): json={"text": 200}, ) - assert hasattr(self.client, "check_file") - resp = self.client.check_file(self.repo, path, version) + resp = self.gh_client.check_file(self.repo, path, version) assert resp.status_code == 200 @responses.activate @@ -101,8 +101,7 @@ def test_check_no_file(self): responses.add(method=responses.HEAD, url=url, status=404) with pytest.raises(ApiError): - assert hasattr(self.client, "check_file") - self.client.check_file(self.repo, path, version) + self.gh_client.check_file(self.repo, path, version) assert responses.calls[1].response.status_code == 404 @responses.activate @@ -117,7 +116,7 @@ def test_get_stacktrace_link(self): json={"text": 200}, ) - assert isinstance(self.install, RepositoryMixin) + assert isinstance(self.install, GitHubEnterpriseIntegration) source_url = self.install.get_stacktrace_link(self.repo, path, "master", version) assert ( source_url @@ -146,7 +145,7 @@ def test_get_codeowner_file(self, mock_check_file): url=url, json={"content": base64.b64encode(GITHUB_CODEOWNERS["raw"].encode()).decode("ascii")}, ) - assert isinstance(self.install, RepositoryMixin) + assert isinstance(self.install, GitHubEnterpriseIntegration) result = self.install.get_codeowner_file( self.config.repository, ref=self.config.default_branch )