Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyuan committed Oct 15, 2023
1 parent db1b805 commit 2b0a9b2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/sentry/integrations/github_enterprise/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit 2b0a9b2

Please sign in to comment.