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
13 changes: 11 additions & 2 deletions test/integration/test_groundlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import string
import time
from datetime import datetime
from http import HTTPStatus
from typing import Any, Dict, Optional, Union

import pytest
Expand Down Expand Up @@ -877,8 +878,12 @@ def test_delete_detector(gl: Groundlight):
gl.delete_detector(detector)

# Verify the detector is actually deleted
with pytest.raises(NotFoundError):
with pytest.raises(ApiException) as exc_info:
gl.get_detector(detector.id)
err = exc_info.value
assert err.status == HTTPStatus.GONE
payload = json.loads(err.body)
assert det_id in payload.get("message", "")

# Create another detector to test deletion by ID string and that an attached image query is deleted
name2 = f"Test delete detector 2 {datetime.utcnow()}"
Expand All @@ -891,8 +896,12 @@ def test_delete_detector(gl: Groundlight):
gl.delete_detector(detector2.id)

# Verify the second detector is also deleted
with pytest.raises(NotFoundError):
with pytest.raises(ApiException) as exc_info:
gl.get_detector(detector2.id)
err = exc_info.value
assert err.status == HTTPStatus.GONE
payload = json.loads(err.body)
assert det_id in payload.get("message", "")

# Verify the image query is also deleted
with pytest.raises(NotFoundException):
Expand Down