| 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" |