-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
tests(resolve_groups): Clean up the tests #91779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ def setUp(self): | |
self.secret = "b3002c3e321d4b7880360d397db2ccfd" | ||
options.set("github-app.webhook-secret", self.secret) | ||
|
||
def _setup_repo_test(self, project): | ||
def _create_integration_and_send_push_event(self): | ||
future_expires = datetime.now().replace(microsecond=0) + timedelta(minutes=5) | ||
with assume_test_silo_mode(SiloMode.CONTROL): | ||
integration = self.create_integration( | ||
|
@@ -305,7 +305,7 @@ def test_simple(self, mock_record): | |
name="baxterthehacker/repo", | ||
) | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_push_event() | ||
|
||
commit_list = list( | ||
Commit.objects.filter( | ||
|
@@ -349,7 +349,7 @@ def test_simple(self, mock_record): | |
@responses.activate | ||
@patch("sentry.integrations.github.webhook.metrics") | ||
def test_creates_missing_repo(self, mock_metrics): | ||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_push_event() | ||
|
||
repos = Repository.objects.all() | ||
assert len(repos) == 1 | ||
|
@@ -369,7 +369,7 @@ def test_ignores_hidden_repo(self): | |
repo.external_id = "35129377" | ||
repo.save() | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_push_event() | ||
|
||
repos = Repository.objects.all() | ||
assert len(repos) == 1 | ||
|
@@ -391,7 +391,7 @@ def test_anonymous_lookup(self): | |
name="bàxterthehacker", | ||
) | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_add_send_push_event() | ||
|
||
commit_list = list( | ||
Commit.objects.filter(organization_id=self.project.organization.id) | ||
|
@@ -576,7 +576,7 @@ def setUp(self): | |
self.secret = "b3002c3e321d4b7880360d397db2ccfd" | ||
options.set("github-app.webhook-secret", self.secret) | ||
|
||
def _setup_repo_test(self, project): | ||
def _create_integration_and_send_pull_request_opened_event(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes it clearer what this helper function does. |
||
future_expires = datetime.now().replace(microsecond=0) + timedelta(minutes=5) | ||
with assume_test_silo_mode(SiloMode.CONTROL): | ||
integration = self.create_integration( | ||
|
@@ -643,7 +643,7 @@ def test_opened(self, mock_record, mock_metrics, mock_open_pr_comment_workflow_d | |
name="baxterthehacker/public-repo", | ||
) | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_pull_request_opened_event() | ||
|
||
prs = PullRequest.objects.filter( | ||
repository_id=repo.id, organization_id=self.project.organization.id | ||
|
@@ -685,14 +685,14 @@ def test_opened_missing_option(self, mock_metrics): | |
organization=self.organization, key="sentry:github_open_pr_bot", value=False | ||
) | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_pull_request_opened_event() | ||
|
||
assert mock_metrics.incr.call_count == 0 | ||
|
||
@patch("sentry.integrations.github.webhook.metrics") | ||
def test_creates_missing_repo(self, mock_metrics): | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_pull_request_opened_event() | ||
|
||
repos = Repository.objects.all() | ||
assert len(repos) == 1 | ||
|
@@ -713,7 +713,7 @@ def test_ignores_hidden_repo(self): | |
repo.external_id = "35129377" | ||
repo.save() | ||
|
||
self._setup_repo_test(self.project) | ||
self._create_integration_and_send_pull_request_opened_event() | ||
|
||
repos = Repository.objects.all() | ||
assert len(repos) == 1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole test we may want to delete, as I believe it may be converted by tests for event_manager or webhooks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it clearer what this helper function does.