"""Tests for notification content builder and Web Push sender.""" from vigilar.alerts.sender import build_notification from vigilar.constants import EventType, Severity def test_build_notification_person_detected(): result = build_notification(EventType.PERSON_DETECTED, Severity.WARNING, "front_entrance", {}) assert result["title"] == "Person Detected" assert "Front Entrance" in result["body"] def test_build_notification_pet_escape(): result = build_notification(EventType.PET_ESCAPE, Severity.ALERT, "back_deck", {"pet_name": "Angel"}) assert result["title"] == "Pet Alert" assert "Angel" in result["body"] def test_build_notification_wildlife_predator(): result = build_notification(EventType.WILDLIFE_PREDATOR, Severity.CRITICAL, "front_entrance", {"species": "bear"}) assert result["title"] == "Wildlife Alert" assert "bear" in result["body"].lower() def test_build_notification_power_loss(): result = build_notification(EventType.POWER_LOSS, Severity.CRITICAL, "ups", {}) assert result["title"] == "Power Alert" assert "battery" in result["body"].lower() def test_build_notification_unknown_event_type(): result = build_notification(EventType.MOTION_START, Severity.WARNING, "cam1", {}) assert result["title"] == "Vigilar Alert" def test_build_notification_has_url(): result = build_notification(EventType.PERSON_DETECTED, Severity.WARNING, "front", {}) assert "url" in result