Misc improvements
This commit is contained in:
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user