From df4e48d2ad4ea5930e98160e18ae04389084e9f8 Mon Sep 17 00:00:00 2001 From: Walkablenormal Date: Sun, 3 May 2026 12:21:54 +0200 Subject: [PATCH] fix: unit tests (#6298) Signed-off-by: Walkablenormal --- tests/test_incidents.py | 3 +++ tests/test_keep_provider_notify_alert_none.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_incidents.py b/tests/test_incidents.py index b80b5d269a..66f0faed9a 100644 --- a/tests/test_incidents.py +++ b/tests/test_incidents.py @@ -2037,11 +2037,14 @@ def test_incident_dto_is_visible_from_db(db_session, create_alert): def test_incident_dto_is_visible_to_db(): """Test that is_visible is correctly mapped in IncidentDto.to_db_incident().""" from keep.api.models.incident import IncidentDto + from keep.api.models.db.incident import IncidentSeverity, IncidentStatus import datetime dto = IncidentDto( id=uuid4(), user_generated_name="Test", + severity=IncidentSeverity.INFO, + status=IncidentStatus.FIRING.value, is_predicted=False, is_candidate=False, is_visible=False, diff --git a/tests/test_keep_provider_notify_alert_none.py b/tests/test_keep_provider_notify_alert_none.py index 7ca7695c22..2dae0cfc85 100644 --- a/tests/test_keep_provider_notify_alert_none.py +++ b/tests/test_keep_provider_notify_alert_none.py @@ -51,8 +51,8 @@ def test_notify_alert_with_none_alert_results_no_crash(): provider.io_handler = MagicMock() provider.io_handler.render_context.return_value = {} - # Mock pusher and alert DAO to avoid DB dependency - with patch("keep.providers.keep_provider.keep_provider.Pusher"), \ + # Mock process_event and alert DAO to avoid DB dependency + with patch("keep.providers.keep_provider.keep_provider.process_event"), \ patch.object(provider, "logger"): # Before the fix, this would raise: # TypeError: object of type 'NoneType' has no len() @@ -95,7 +95,7 @@ def test_notify_alert_with_none_alert_results_and_alert_param(): provider.io_handler = MagicMock() provider.io_handler.render_context.return_value = alert_data - with patch("keep.providers.keep_provider.keep_provider.Pusher"), \ + with patch("keep.providers.keep_provider.keep_provider.process_event"), \ patch.object(provider, "logger"): # This should work: alert param provides the alert data result = provider._notify_alert(alert=alert_data)