mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 11:06:32 +00:00
[AZ-175] Media table integration with XxHash64 content hashing and status lifecycle
Made-with: Cursor
This commit is contained in:
@@ -74,7 +74,7 @@ def test_merged_annotation_nested_sections():
|
||||
assert out["altitude"] == 100
|
||||
|
||||
|
||||
def test_build_media_detect_config_uses_api_path_and_defaults_when_api_empty():
|
||||
def test_resolve_media_for_detect_uses_api_path_and_defaults_when_api_empty():
|
||||
# Arrange
|
||||
import main
|
||||
|
||||
@@ -84,13 +84,14 @@ def test_build_media_detect_config_uses_api_path_and_defaults_when_api_empty():
|
||||
mock_ann.fetch_media_path.return_value = "/m/file.jpg"
|
||||
with patch("main.annotations_client", mock_ann):
|
||||
# Act
|
||||
cfg = main._build_media_detect_config_dict("mid-1", tm, None)
|
||||
cfg, path = main._resolve_media_for_detect("mid-1", tm, None)
|
||||
# Assert
|
||||
assert cfg["paths"] == ["/m/file.jpg"]
|
||||
assert path == "/m/file.jpg"
|
||||
assert "paths" not in cfg
|
||||
assert "probability_threshold" not in cfg
|
||||
|
||||
|
||||
def test_build_media_detect_config_override_wins():
|
||||
def test_resolve_media_for_detect_override_wins():
|
||||
# Arrange
|
||||
import main
|
||||
|
||||
@@ -104,14 +105,15 @@ def test_build_media_detect_config_override_wins():
|
||||
mock_ann.fetch_media_path.return_value = "/m/v.mp4"
|
||||
with patch("main.annotations_client", mock_ann):
|
||||
# Act
|
||||
cfg = main._build_media_detect_config_dict("vid-1", tm, override)
|
||||
cfg, path = main._resolve_media_for_detect("vid-1", tm, override)
|
||||
# Assert
|
||||
assert cfg["probability_threshold"] == 0.99
|
||||
assert cfg["altitude"] == 500
|
||||
assert cfg["paths"] == ["/m/v.mp4"]
|
||||
assert path == "/m/v.mp4"
|
||||
assert "paths" not in cfg
|
||||
|
||||
|
||||
def test_build_media_detect_config_raises_when_no_media_path():
|
||||
def test_resolve_media_for_detect_raises_when_no_media_path():
|
||||
# Arrange
|
||||
import main
|
||||
|
||||
@@ -122,5 +124,5 @@ def test_build_media_detect_config_raises_when_no_media_path():
|
||||
with patch("main.annotations_client", mock_ann):
|
||||
# Act / Assert
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
main._build_media_detect_config_dict("missing", tm, None)
|
||||
main._resolve_media_for_detect("missing", tm, None)
|
||||
assert exc.value.status_code == 503
|
||||
|
||||
Reference in New Issue
Block a user