Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Fix notification tests after refactoring: update for simplified caching

tombii0e0094a91fe2
diff --git a/tests/notifications/test_manager.py b/tests/notifications/test_manager.py
index 2eaa48fb33..5852d51751 100644
--- a/tests/notifications/test_manager.py
+++ b/tests/notifications/test_manager.py
@@ -302,8 +302,8 @@ class TestShouldNotify:
assert result is False
- def test_should_notify_default_true(self, mocker):
- """Test notification defaults to True when setting missing."""
+ def test_should_notify_default_false(self, mocker):
+ """Test notification defaults to False when setting missing."""
snapshot = {}
manager = NotificationManager(settings_snapshot=snapshot)
@@ -311,8 +311,8 @@ class TestShouldNotify:
EventType.RESEARCH_COMPLETED, user_id="test_user"
)
- # Default is True for missing settings
- assert result is True
+ # Default is False for missing settings to avoid infinite loops
+ assert result is False
class TestTestService:
diff --git a/tests/notifications/test_service.py b/tests/notifications/test_service.py
index bc2e1f6d4f..79a5e34eee 100644
--- a/tests/notifications/test_service.py
+++ b/tests/notifications/test_service.py
@@ -23,7 +23,6 @@ class TestNotificationServiceInit:
service = NotificationService()
assert service.apprise is not None
- assert service._apprise_cache == {}
class TestSend:
@@ -50,8 +49,8 @@ class TestSend:
assert mock_apprise_instance.notify.call_count == 1
@patch("local_deep_research.notifications.service.apprise.Apprise")
- def test_send_caches_apprise_instances(self, mock_apprise_class, mocker):
- """Test Apprise instances are cached by URL hash."""
+ def test_send_creates_temporary_instances(self, mock_apprise_class, mocker):
+ """Test temporary Apprise instances are created for each send."""
mock_apprise_instance = MagicMock()
mock_apprise_instance.notify.return_value = True
mock_apprise_instance.add.return_value = True
@@ -73,8 +72,9 @@ class TestSend:
service_urls="discord://webhook/token",
)
- # Should only create one cached instance
- assert len(service._apprise_cache) == 1
+ # Should create a new instance for each send (no caching)
+ # mock_apprise_class is called during __init__ (1) + 2 sends = 3 total
+ assert mock_apprise_class.call_count == 3
# Send notification with different URL
service.send(
@@ -83,8 +83,8 @@ class TestSend:
service_urls="slack://token/channel",
)
- # Should now have two cached instances
- assert len(service._apprise_cache) == 2
+ # Should now have 4 total calls (1 init + 3 sends)
+ assert mock_apprise_class.call_count == 4
@patch("local_deep_research.notifications.service.apprise.Apprise")
@patch("local_deep_research.notifications.service.time.sleep")