Skip to content

Commit 91822ee

Browse files
author
brandon
committed
add testing for iqs on the deleted detector
1 parent d8af357 commit 91822ee

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

test/integration/test_groundlight.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from groundlight.optional_imports import *
1616
from groundlight.status_codes import is_user_error
1717
from ksuid import KsuidMs
18+
from groundlight_openapi_client.exceptions import NotFoundException
1819
from model import (
1920
BinaryClassificationResult,
2021
BoundingBoxResult,
@@ -867,9 +868,10 @@ def test_delete_detector(gl: Groundlight):
867868
with pytest.raises(NotFoundError):
868869
gl.get_detector(detector.id)
869870

870-
# Create another detector to test deletion by ID string
871+
# Create another detector to test deletion by ID string and that an attached image query is deleted
871872
name2 = f"Test delete detector 2 {datetime.utcnow()}"
872873
detector2 = gl.create_detector(name=name2, query=query, pipeline_config=pipeline_config)
874+
gl.submit_image_query(detector2, "test/assets/dog.jpeg")
873875

874876
# Delete using detector ID string
875877
gl.delete_detector(detector2.id)
@@ -878,7 +880,11 @@ def test_delete_detector(gl: Groundlight):
878880
with pytest.raises(NotFoundError):
879881
gl.get_detector(detector2.id)
880882

883+
# Verify the image query is also deleted
884+
with pytest.raises(NotFoundException):
885+
gl.get_image_query(detector2.id)
886+
881887
# Test deleting a non-existent detector raises NotFoundError
882888
fake_detector_id = "det_fake123456789"
883889
with pytest.raises(NotFoundError):
884-
gl.delete_detector(fake_detector_id)
890+
gl.delete_detector(fake_detector_id) # type: ignore

0 commit comments

Comments
 (0)