Spaces:
Runtime error
Runtime error
File size: 554 Bytes
1b4ba2d e6a346e 1b4ba2d e6a346e 6b52b34 e6a346e 6b52b34 e6a346e 6b52b34 e6a346e 6b52b34 e6a346e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import pytest
import os
from app import save_snapshot, log_violation
import numpy as np
import cv2
def test_log_violation():
frame = np.zeros((640, 640, 3), dtype=np.uint8)
violation_data = {
'site_id': "Site1",
'camera_id': "Camera1",
'violation_type': "No Helmet",
'timestamp': "2025-06-07T09:23:00Z",
'snapshot_url': save_snapshot(frame),
'severity': "Critical"
}
log_violation(violation_data)
assert os.path.exists("/snapshots/violation_logs.json"), "Violation logs file not found" |