2
2
3
3
from django .db import IntegrityError
4
4
5
+ from sentry .issues .grouptype import MonitorIncidentType
5
6
from sentry .monitors .types import DATA_SOURCE_CRON_MONITOR
6
7
from sentry .monitors .utils import ensure_cron_detector
7
8
from sentry .testutils .cases import TestCase
@@ -28,7 +29,7 @@ def test_creates_data_source_and_detector_for_new_monitor(self):
28
29
)
29
30
assert data_source is not None
30
31
detector = Detector .objects .get (
31
- type = "monitor_check_in_failure" ,
32
+ type = MonitorIncidentType . slug ,
32
33
project_id = self .monitor .project_id ,
33
34
name = self .monitor .name ,
34
35
)
@@ -48,7 +49,7 @@ def test_idempotent_for_existing_data_source(self):
48
49
source_id = str (self .monitor .id ),
49
50
)
50
51
detector = Detector .objects .get (
51
- type = "monitor_check_in_failure" ,
52
+ type = MonitorIncidentType . slug ,
52
53
project_id = self .monitor .project_id ,
53
54
name = self .monitor .name ,
54
55
)
@@ -63,7 +64,7 @@ def test_idempotent_for_existing_data_source(self):
63
64
source_id = str (self .monitor .id ),
64
65
)
65
66
detector_after = Detector .objects .get (
66
- type = "monitor_check_in_failure" ,
67
+ type = MonitorIncidentType . slug ,
67
68
project_id = self .monitor .project_id ,
68
69
name = self .monitor .name ,
69
70
)
@@ -80,7 +81,7 @@ def test_with_owner_user(self):
80
81
self .monitor .save ()
81
82
ensure_cron_detector (self .monitor )
82
83
detector = Detector .objects .get (
83
- type = "monitor_check_in_failure" ,
84
+ type = MonitorIncidentType . slug ,
84
85
project_id = self .monitor .project_id ,
85
86
)
86
87
assert detector .owner_user_id == self .user .id
@@ -90,7 +91,7 @@ def test_with_no_owner(self):
90
91
ensure_cron_detector (self .monitor )
91
92
92
93
detector = Detector .objects .get (
93
- type = "monitor_check_in_failure" ,
94
+ type = MonitorIncidentType . slug ,
94
95
project_id = self .monitor .project_id ,
95
96
)
96
97
assert detector .owner_user_id is None
0 commit comments