Skip to content
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

ref: use base factories create_environment #74882

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading