Skip to content

Commit

Permalink
manual updates for the fixtures / comparators / factories
Browse files Browse the repository at this point in the history
  • Loading branch information
saponifi3d committed Sep 13, 2024
1 parent 0cb784d commit 1ce8774
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/sentry/backup/comparators.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ def get_default_comparators() -> dict[str, list[JSONScrubbingComparator]]:
],
"sentry.userrole": [DateUpdatedComparator("date_updated")],
"sentry.userroleuser": [DateUpdatedComparator("date_updated")],
"workflow_engine.datacondition": [DateUpdatedComparator("date_updated", "date_added")],
"workflow_engine.datasource": [DateUpdatedComparator("date_updated", "date_added")],
"workflow_engine.detector": [DateUpdatedComparator("date_updated", "date_added")],
"workflow_engine.workflow": [DateUpdatedComparator("date_updated", "date_added")],
Expand Down
15 changes: 14 additions & 1 deletion src/sentry/testutils/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@
from sentry.users.services.user import RpcUser
from sentry.utils import loremipsum
from sentry.utils.performance_issues.performance_problem import PerformanceProblem
from sentry.workflow_engine.models import DataSource, Detector, Workflow, WorkflowAction
from sentry.workflow_engine.models import (
DataCondition,
DataSource,
Detector,
Workflow,
WorkflowAction,
)
from social_auth.models import UserSocialAuth


Expand Down Expand Up @@ -2057,6 +2063,13 @@ def create_workflowaction(
workflow = Factories.create_workflow()
return WorkflowAction.objects.create(workflow=workflow, **kwargs)

@staticmethod
@assume_test_silo_mode(SiloMode.REGION)
def create_datacondition(
**kwargs,
) -> DataCondition:
return DataCondition.objects.create(**kwargs)

@staticmethod
@assume_test_silo_mode(SiloMode.REGION)
def create_datasource(
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/testutils/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ def create_workflowaction(self, *args, **kwargs):
def create_datasource(self, *args, **kwargs):
return Factories.create_datasource(*args, **kwargs)

def create_datacondition(self, *args, **kwargs):
return Factories.create_datacondition(*args, **kwargs)

def create_detector(self, *args, **kwargs):
return Factories.create_detector(*args, **kwargs)

Expand Down
6 changes: 4 additions & 2 deletions src/sentry/testutils/helpers/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,11 @@ def create_exhaustive_organization(
)

workflow = self.create_workflow(organization=org)
self.create_workflowaction(workflow=workflow)
detector = self.create_detector(organization=org)
self.create_datasource(organization=org)
self.create_detector(organization=org)

self.create_workflowaction(workflow=workflow)
self.create_datacondition(detector=detector)

return org

Expand Down

0 comments on commit 1ce8774

Please sign in to comment.