2222
2323class TestConnectWorkflowsToIssueStream (TestCase ):
2424 def test_creates_detector_workflow_connections (self ) -> None :
25- project = self .create_project ()
26- workflow1 = Workflow .objects .create (
27- organization = project .organization ,
25+ project = self .create_project (create_default_detectors = False )
26+ workflow1 = self .create_workflow (
2827 name = "Test Workflow 1" ,
29- )
30- workflow2 = Workflow .objects .create (
3128 organization = project .organization ,
29+ )
30+ workflow2 = self .create_workflow (
3231 name = "Test Workflow 2" ,
32+ organization = project .organization ,
3333 )
3434
3535 connections = connect_workflows_to_issue_stream (project , [workflow1 , workflow2 ])
@@ -45,8 +45,8 @@ def test_creates_detector_workflow_connections(self) -> None:
4545 assert detector .type == IssueStreamGroupType .slug
4646
4747 def test_uses_issue_stream_detector (self ) -> None :
48- project = self .create_project ()
49- workflow = Workflow . objects . create (
48+ project = self .create_project (create_default_detectors = False )
49+ workflow = self . create_workflow (
5050 organization = project .organization ,
5151 name = "Test Workflow" ,
5252 )
@@ -65,17 +65,18 @@ def test_uses_issue_stream_detector(self) -> None:
6565
6666 def test_uses_preexisting_issue_stream_detector (self ) -> None :
6767 """Integration test: verifies that if an issue stream detector already exists, it reuses it."""
68- project = self .create_project ()
68+ project = self .create_project (create_default_detectors = False )
6969
7070 # Create the default detectors first (simulating project setup signal)
7171 default_detectors = ensure_default_detectors (project )
7272 existing_detector = default_detectors [IssueStreamGroupType .slug ]
7373
7474 # Now connect workflows - should use the existing detector
75- workflow = Workflow . objects . create (
75+ workflow = self . create_workflow (
7676 organization = project .organization ,
7777 name = "Test Workflow" ,
7878 )
79+
7980 connections = connect_workflows_to_issue_stream (project , [workflow ])
8081
8182 # Verify it used the pre-existing detector
@@ -91,23 +92,20 @@ def test_uses_preexisting_issue_stream_detector(self) -> None:
9192class TestCreatePriorityWorkflow (TestCase ):
9293 def test_creates_workflow_with_correct_name (self ) -> None :
9394 org = self .create_organization ()
94-
9595 workflow = create_priority_workflow (org )
9696
9797 assert workflow .name == "Send a notification for high priority issues"
9898 assert workflow .organization_id == org .id
9999
100100 def test_creates_when_condition_group (self ) -> None :
101101 org = self .create_organization ()
102-
103102 workflow = create_priority_workflow (org )
104103
105104 assert workflow .when_condition_group is not None
106105 assert workflow .when_condition_group .logic_type == DataConditionGroup .Type .ANY_SHORT_CIRCUIT
107106
108107 def test_creates_data_conditions (self ) -> None :
109108 org = self .create_organization ()
110-
111109 workflow = create_priority_workflow (org )
112110
113111 conditions = DataCondition .objects .filter (condition_group = workflow .when_condition_group )
@@ -128,8 +126,10 @@ def test_creates_email_action(self) -> None:
128126
129127 action = Action .objects .get (type = Action .Type .EMAIL )
130128 assert action .config == {
131- "target_type" : "IssueOwners" ,
129+ "target_type" : 4 ,
132130 "target_identifier" : None ,
131+ }
132+ assert action .data == {
133133 "fallthrough_type" : FallthroughChoiceType .ACTIVE_MEMBERS .value ,
134134 }
135135
0 commit comments