Skip to content

Commit

Permalink
fix: move create_project to just snuba tests
Browse files Browse the repository at this point in the history
- Remove changes to other tests
  • Loading branch information
wmak committed Nov 28, 2024
1 parent a8761a1 commit 9a6b10b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions src/sentry/testutils/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,13 @@ def snuba_get_config(cls):
def snuba_update_config(cls, config_vals):
return _snuba_pool.request("POST", "/config.json", body=json.dumps(config_vals))

def create_project(self, **kwargs) -> Project:
if "flags" not in kwargs:
# We insert events directly into snuba in tests, so we need to set has_transactions to True so the
# application knows that events have been sent
kwargs["flags"] = Project.flags.has_transactions
return super().create_project(**kwargs)

def init_snuba(self):
self.snuba_eventstream = SnubaEventStream()
self.snuba_tagstore = SnubaTagStorage()
Expand Down
4 changes: 0 additions & 4 deletions src/sentry/testutils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,6 @@ def create_project(
kwargs["slug"] = slugify(str(kwargs["name"]))
if not organization and teams:
organization = teams[0].organization
if "flags" not in kwargs:
# We insert events directly into snuba in tests, so we need to set has_transactions to True so the
# application knows that events have been sent
kwargs["flags"] = Project.flags.has_transactions

with transaction.atomic(router.db_for_write(Project)):
project = Project.objects.create(organization=organization, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setUp(self):
self.team = self.create_team()

def test_no_platform(self):
project = self.create_project(teams=[self.team], name="foo", platform=None, flags=0)
project = self.create_project(teams=[self.team], name="foo", platform=None)

url = reverse(
"sentry-api-0-project-create-sample-transaction",
Expand Down

0 comments on commit 9a6b10b

Please sign in to comment.