Skip to content

Commit 2e7bde8

Browse files
roxanne-oroxanne-oAuto-format Bot
authored
Fix delete predictor test (#381)
Since we now throw a 410 GONE error on recently deleted soft-delete models, this test needs to be updated. Tests passed against integ for me locally --------- Co-authored-by: roxanne-o <[email protected]> Co-authored-by: Auto-format Bot <[email protected]>
1 parent 1917212 commit 2e7bde8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/integration/test_groundlight.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import string
77
import time
88
from datetime import datetime
9+
from http import HTTPStatus
910
from typing import Any, Dict, Optional, Union
1011

1112
import pytest
@@ -877,8 +878,12 @@ def test_delete_detector(gl: Groundlight):
877878
gl.delete_detector(detector)
878879

879880
# Verify the detector is actually deleted
880-
with pytest.raises(NotFoundError):
881+
with pytest.raises(ApiException) as exc_info:
881882
gl.get_detector(detector.id)
883+
err = exc_info.value
884+
assert err.status == HTTPStatus.GONE
885+
payload = json.loads(err.body)
886+
assert det_id in payload.get("message", "")
882887

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

893898
# Verify the second detector is also deleted
894-
with pytest.raises(NotFoundError):
899+
with pytest.raises(ApiException) as exc_info:
895900
gl.get_detector(detector2.id)
901+
err = exc_info.value
902+
assert err.status == HTTPStatus.GONE
903+
payload = json.loads(err.body)
904+
assert det_id in payload.get("message", "")
896905

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

0 commit comments

Comments
 (0)