Misc improvements

This commit is contained in:
2026-02-20 06:59:31 +00:00
parent 734cade8d9
commit e9d80def08
33 changed files with 1844 additions and 420 deletions

View File

@@ -201,6 +201,25 @@ class TestHTTPRAGService:
mock_client.aclose.assert_called_once()
@pytest.mark.asyncio
async def test_http_generic_exception(self):
"""Test HTTP RAG service handles generic exceptions during processing."""
mock_response = Mock()
mock_response.raise_for_status = Mock()
# Make json() raise a generic exception
mock_response.json = Mock(side_effect=ValueError("Invalid response format"))
with patch("httpx.AsyncClient") as mock_client_class:
mock_client = AsyncMock()
mock_client.post = AsyncMock(return_value=mock_response)
mock_client_class.return_value = mock_client
service = HTTPRAGService(endpoint_url="http://test.example.com/rag")
messages = [{"role": "user", "content": "Hello"}]
with pytest.raises(ValueError, match="Invalid response format"):
await service.query(messages)
class TestRAGModels:
"""Tests for RAG data models."""