File size: 647 Bytes
6e455d2 d3afd25 6e455d2 c0d8622 d3afd25 c0d8622 d3afd25 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import pytest
from app import send_alert
import logging
def test_send_alert():
"""Test alert sending functionality"""
violation = {
'violation_type': 'No Helmet',
'severity': 'Critical',
'timestamp': '2025-06-07T09:23:00Z',
'site_id': 'SITE001',
'camera_id': 'CAM001'
}
# Capture log output to verify alert was sent
with pytest.raises(Exception):
# This should not raise an exception
send_alert(violation)
assert True, "Alert should be sent without errors"
else:
# If no exception, the test passes
assert True, "Alert sent successfully" |