Skip to content

Commit

Permalink
ref: use base factories create_environment (#74882)
Browse files Browse the repository at this point in the history
<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored and Christinarlong committed Jul 26, 2024
1 parent 6eda059 commit 3fa4bfc
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/sentry/api/endpoints/test_group_user_reports.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3fa4bfc

Please sign in to comment.