Spaces:
Runtime error
Runtime error
| 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" |