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.

test: Fix 2 failing notification URL builder tests

LearningCircuitfb7c36b2581c
diff --git a/tests/notifications/test_url_builder.py b/tests/notifications/test_url_builder.py
index 1d7d56cfcf..63fdaa99dd 100644
--- a/tests/notifications/test_url_builder.py
+++ b/tests/notifications/test_url_builder.py
@@ -105,14 +105,20 @@ class TestBuildNotificationURL:
def test_build_with_external_url_setting(self):
"""Test URL construction with external_url setting."""
mock_settings = Mock()
- mock_settings.get_setting.return_value = "https://ldr.example.com"
+ # Mock returns different values for different settings
+ mock_settings.get_setting.side_effect = lambda key, default=None: {
+ "app.external_url": "https://ldr.example.com",
+ "app.host": "localhost",
+ "app.port": 5000,
+ }.get(key, default)
url = build_notification_url(
"/research/123", settings_manager=mock_settings
)
assert url == "https://ldr.example.com/research/123"
- mock_settings.get_setting.assert_called_with(
+ # Verify external_url was requested
+ mock_settings.get_setting.assert_any_call(
"app.external_url", default=""
)
@@ -208,15 +214,17 @@ class TestBuildNotificationURL:
assert url == "not-a-valid-url/path"
def test_build_handles_settings_exception(self):
- """Test graceful handling of settings errors."""
+ """Test that settings errors are wrapped in URLValidationError."""
mock_settings = Mock()
mock_settings.get_setting.side_effect = Exception("Database error")
- # Should fall back to default
- url = build_notification_url(
- "/research/123", settings_manager=mock_settings
- )
- assert url == "http://localhost:5000/research/123"
+ # Should raise URLValidationError wrapping the original exception
+ with pytest.raises(
+ URLValidationError, match="Failed to build notification URL"
+ ):
+ build_notification_url(
+ "/research/123", settings_manager=mock_settings
+ )
def test_build_with_port_in_external_url(self):
"""Test external_url with port number."""