2222
2323
2424class MarkFailedTestCase (TestCase ):
25- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
26- def test_mark_failed_default_params (self , mock_create_incident_occurrence ):
25+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
26+ def test_mark_failed_default_params (self , mock_send_incident_occurrence ):
2727 monitor = Monitor .objects .create (
2828 name = "test monitor" ,
2929 organization_id = self .organization .id ,
@@ -61,16 +61,16 @@ def test_mark_failed_default_params(self, mock_create_incident_occurrence):
6161 monitor_incidents = MonitorIncident .objects .filter (monitor_environment = monitor_environment )
6262 assert len (monitor_incidents ) == 1
6363
64- assert mock_create_incident_occurrence .call_count == 1
65- assert mock_create_incident_occurrence .call_args == mock .call (
64+ assert mock_send_incident_occurrence .call_count == 1
65+ assert mock_send_incident_occurrence .call_args == mock .call (
6666 checkin ,
6767 [checkin ],
6868 monitor_incidents [0 ],
6969 checkin .date_added ,
7070 )
7171
72- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
73- def test_mark_failed_muted (self , mock_create_incident_occurrence ):
72+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
73+ def test_mark_failed_muted (self , mock_send_incident_occurrence ):
7474 monitor = Monitor .objects .create (
7575 name = "test monitor" ,
7676 organization_id = self .organization .id ,
@@ -103,11 +103,11 @@ def test_mark_failed_muted(self, mock_create_incident_occurrence):
103103 assert monitor .is_muted
104104 assert monitor_environment .status == MonitorStatus .ERROR
105105
106- assert mock_create_incident_occurrence .call_count == 0
106+ assert mock_send_incident_occurrence .call_count == 0
107107 assert monitor_environment .active_incident is not None
108108
109- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
110- def test_mark_failed_env_muted (self , mock_create_incident_occurrence ):
109+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
110+ def test_mark_failed_env_muted (self , mock_send_incident_occurrence ):
111111 monitor = Monitor .objects .create (
112112 name = "test monitor" ,
113113 organization_id = self .organization .id ,
@@ -142,11 +142,11 @@ def test_mark_failed_env_muted(self, mock_create_incident_occurrence):
142142 assert not monitor .is_muted
143143 assert monitor_environment .is_muted
144144 assert monitor_environment .status == MonitorStatus .ERROR
145- assert mock_create_incident_occurrence .call_count == 0
145+ assert mock_send_incident_occurrence .call_count == 0
146146 assert monitor_environment .active_incident is not None
147147
148- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
149- def test_mark_failed_issue_threshold (self , mock_create_incident_occurrence ):
148+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
149+ def test_mark_failed_issue_threshold (self , mock_send_incident_occurrence ):
150150 failure_issue_threshold = 8
151151 monitor = Monitor .objects .create (
152152 name = "test monitor" ,
@@ -222,7 +222,7 @@ def test_mark_failed_issue_threshold(self, mock_create_incident_occurrence):
222222 assert monitor_incident .grouphash == monitor_environment .active_incident .grouphash
223223
224224 # assert correct number of occurrences was sent
225- assert mock_create_incident_occurrence .call_count == failure_issue_threshold
225+ assert mock_send_incident_occurrence .call_count == failure_issue_threshold
226226
227227 # send another check-in to make sure the incident does not change
228228 status = next (failure_statuses )
@@ -242,7 +242,7 @@ def test_mark_failed_issue_threshold(self, mock_create_incident_occurrence):
242242 assert monitor_incident .grouphash == monitor_environment .active_incident .grouphash
243243
244244 # assert correct number of occurrences was sent
245- assert mock_create_incident_occurrence .call_count == failure_issue_threshold + 1
245+ assert mock_send_incident_occurrence .call_count == failure_issue_threshold + 1
246246
247247 # Resolve the incident with an OK check-in
248248 ok_checkin = MonitorCheckIn .objects .create (
@@ -273,8 +273,8 @@ def test_mark_failed_issue_threshold(self, mock_create_incident_occurrence):
273273
274274 # Test to make sure that timeout mark_failed (which occur in the past)
275275 # correctly create issues once passing the failure_issue_threshold
276- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
277- def test_mark_failed_issue_threshold_timeout (self , mock_create_incident_occurrence ):
276+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
277+ def test_mark_failed_issue_threshold_timeout (self , mock_send_incident_occurrence ):
278278 failure_issue_threshold = 8
279279 monitor = Monitor .objects .create (
280280 name = "test monitor" ,
@@ -341,11 +341,11 @@ def test_mark_failed_issue_threshold_timeout(self, mock_create_incident_occurren
341341 assert monitor_incident .grouphash == monitor_environment .active_incident .grouphash
342342
343343 # assert correct number of occurrences was sent
344- assert mock_create_incident_occurrence .call_count == failure_issue_threshold
344+ assert mock_send_incident_occurrence .call_count == failure_issue_threshold
345345
346346 # we are duplicating this test as the code paths are different, for now
347- @mock .patch ("sentry.monitors.logic.incidents.create_incident_occurrence " )
348- def test_mark_failed_issue_threshold_disabled (self , mock_create_incident_occurrence ):
347+ @mock .patch ("sentry.monitors.logic.incidents.send_incident_occurrence " )
348+ def test_mark_failed_issue_threshold_disabled (self , mock_send_incident_occurrence ):
349349 failure_issue_threshold = 8
350350 monitor = Monitor .objects .create (
351351 name = "test monitor" ,
@@ -381,7 +381,7 @@ def test_mark_failed_issue_threshold_disabled(self, mock_create_incident_occurre
381381 assert monitor .is_muted
382382 assert monitor_environment .status == MonitorStatus .ERROR
383383
384- assert mock_create_incident_occurrence .call_count == 0
384+ assert mock_send_incident_occurrence .call_count == 0
385385 assert monitor_environment .active_incident is not None
386386
387387 def test_mark_failed_issue_assignment (self ):
0 commit comments