Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ def _get_detector_post_data(self, **overrides):

def test_create_monitor_incident_detector_validates_correctly(self):
data = self._get_detector_post_data()
with self.tasks():
response = self.get_success_response(
self.organization.slug,
**data,
status_code=201,
)
response = self.get_success_response(
self.organization.slug,
**data,
status_code=201,
)

assert response.data["name"] == "Test Monitor Detector"
assert response.data["type"] == MonitorIncidentType.slug
Expand Down Expand Up @@ -195,12 +194,11 @@ def test_create_monitor_with_optional_fields(self):
}
],
)
with self.tasks():
self.get_success_response(
self.organization.slug,
**data,
status_code=201,
)
self.get_success_response(
self.organization.slug,
**data,
status_code=201,
)

monitor = Monitor.objects.get(
organization_id=self.organization.id, slug="full-config-monitor"
Expand Down Expand Up @@ -228,13 +226,12 @@ def test_update_monitor_incident_detector(self):
"name": "Updated Detector",
"owner": new_user.get_actor_identifier(),
}
with self.tasks():
response = self.get_success_response(
self.organization.slug,
self.detector.id,
**data,
status_code=200,
)
response = self.get_success_response(
self.organization.slug,
self.detector.id,
**data,
status_code=200,
)

assert response.data["name"] == "Updated Detector"
assert response.data["owner"] == {
Expand Down Expand Up @@ -269,13 +266,12 @@ def test_update_monitor_config_through_detector(self):
}
],
}
with self.tasks():
self.get_success_response(
self.organization.slug,
self.detector.id,
**data,
status_code=200,
)
self.get_success_response(
self.organization.slug,
self.detector.id,
**data,
status_code=200,
)

self.detector.refresh_from_db()
assert self.detector.name == "Updated Detector With Monitor Config"
Expand All @@ -295,12 +291,11 @@ class OrganizationDetectorDeleteTest(BaseDetectorTestCase):
def test_delete_monitor_incident_detector(self):
detector_id = self.detector.id
monitor_id = self.monitor.id
with self.tasks():
self.get_success_response(
self.organization.slug,
detector_id,
status_code=204,
)
self.get_success_response(
self.organization.slug,
detector_id,
status_code=204,
)
self.detector.refresh_from_db()
assert self.detector.status == ObjectStatus.PENDING_DELETION
assert Monitor.objects.filter(id=monitor_id).exists()
Loading