From 3fa4bfc372e61a5636d1eadcc7b8eb3079290080 Mon Sep 17 00:00:00 2001 From: anthony sottile <103459774+asottile-sentry@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:10:09 -0400 Subject: [PATCH] ref: use base factories create_environment (#74882) --- .../sentry/api/endpoints/test_group_user_reports.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/sentry/api/endpoints/test_group_user_reports.py b/tests/sentry/api/endpoints/test_group_user_reports.py index 325d070814787f..ae4a7a795ea4a1 100644 --- a/tests/sentry/api/endpoints/test_group_user_reports.py +++ b/tests/sentry/api/endpoints/test_group_user_reports.py @@ -1,6 +1,5 @@ from functools import cached_property -from sentry.models.environment import Environment from sentry.models.userreport import UserReport from sentry.testutils.cases import APITestCase, SnubaTestCase from sentry.testutils.helpers.datetime import before_now, iso_format @@ -10,8 +9,8 @@ class GroupUserReport(APITestCase, SnubaTestCase): def setUp(self): super().setUp() self.project = self.create_project() - self.env1 = self.create_environment(self.project, "production") - self.env2 = self.create_environment(self.project, "staging") + self.env1 = self.create_environment(self.project, name="production") + self.env2 = self.create_environment(self.project, name="staging") self.env1_events = self.create_events_for_environment(self.env1, 5) self.env2_events = self.create_events_for_environment(self.env2, 5) @@ -29,11 +28,6 @@ def setUp(self): def path(self): return f"/api/0/groups/{self.group.id}/user-feedback/" - def create_environment(self, project, name): - env = Environment.objects.create(organization_id=project.organization_id, name=name) - env.add_project(project) - return env - def create_events_for_environment(self, environment, num_events): return [ self.store_event( @@ -91,7 +85,7 @@ def test_no_environment_does_not_exists(self): def test_no_environment(self): self.login_as(user=self.user) - empty_env = self.create_environment(self.project, "") + empty_env = self.create_environment(self.project, name="") empty_env_events = self.create_events_for_environment(empty_env, 5) userreports = self.create_user_report_for_events( self.project, self.group, empty_env_events, empty_env