Skip to content

Commit 07421af

Browse files
committed
Docstrings for query integration tests
1 parent df44135 commit 07421af

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

tests/integration/endpoints/test_query_v2_integration.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def mock_llama_stack_client_fixture(
4040
4141
This is the only external dependency we mock for integration tests,
4242
as it represents an external service call.
43+
44+
Parameters:
45+
mocker (MockerFixture): pytest-mock fixture used to create and patch mocks.
46+
47+
Returns:
48+
mock_client: The mocked Llama Stack client instance configured as described above.
4349
"""
4450
# Patch in app.endpoints.query where it's actually used by query_endpoint_handler_base
4551
mock_holder_class = mocker.patch("app.endpoints.query.AsyncLlamaStackClientHolder")
@@ -107,6 +113,9 @@ def patch_db_session_fixture(
107113
This sets up the global session_local in app.database to use the test database.
108114
Uses an in-memory SQLite database, isolating tests from production data.
109115
This fixture is autouse=True, so it applies to all tests in this module automatically.
116+
117+
Returns:
118+
The test database Session instance to be used by the test.
110119
"""
111120
# Store original values to restore later
112121
original_engine = app.database.engine
@@ -188,12 +197,15 @@ async def test_query_v2_endpoint_handles_connection_error(
188197
- HTTPException is raised with correct status code
189198
- Error response includes proper error details
190199
191-
Args:
200+
Parameters:
192201
test_config: Test configuration
193202
mock_llama_stack_client: Mocked Llama Stack client
194203
test_request: FastAPI request
195204
test_auth: noop authentication tuple
196205
mocker: pytest-mock fixture
206+
207+
Returns:
208+
None
197209
"""
198210
_ = test_config
199211

@@ -232,11 +244,14 @@ async def test_query_v2_endpoint_empty_query(
232244
- Validation works correctly
233245
- Error response is returned if needed
234246
235-
Args:
247+
Parameters:
236248
test_config: Test configuration
237249
mock_llama_stack_client: Mocked Llama Stack client
238250
test_request: FastAPI request
239251
test_auth: noop authentication tuple
252+
253+
Returns:
254+
None
240255
"""
241256
_ = test_config
242257
_ = mock_llama_stack_client
@@ -527,13 +542,16 @@ async def test_query_v2_endpoint_bypasses_tools_when_no_tools_true(
527542
- Response succeeds without tools
528543
- Integration between query handler and tool preparation
529544
530-
Args:
545+
Parameters:
531546
test_config: Test configuration
532547
mock_llama_stack_client: Mocked Llama Stack client
533548
test_request: FastAPI request
534549
test_auth: noop authentication tuple
535550
patch_db_session: Test database session
536551
mocker: pytest-mock fixture
552+
553+
Returns:
554+
None
537555
"""
538556
_ = test_config
539557
_ = patch_db_session
@@ -580,13 +598,16 @@ async def test_query_v2_endpoint_uses_tools_when_available(
580598
- Response succeeds with tools enabled
581599
- Integration between query handler, vector stores, and tool preparation
582600
583-
Args:
601+
Parameters:
584602
test_config: Test configuration
585603
mock_llama_stack_client: Mocked Llama Stack client
586604
test_request: FastAPI request
587605
test_auth: noop authentication tuple
588606
patch_db_session: Test database session
589607
mocker: pytest-mock fixture
608+
609+
Returns:
610+
None
590611
"""
591612
_ = test_config
592613
_ = patch_db_session
@@ -805,13 +826,16 @@ async def test_query_v2_endpoint_creates_valid_cache_entry(
805826
806827
Note: We spy on cache storage to verify integration, not to mock it.
807828
808-
Args:
829+
Parameters:
809830
test_config: Test configuration
810831
mock_llama_stack_client: Mocked Llama Stack client
811832
test_request: FastAPI request
812833
test_auth: noop authentication tuple
813834
patch_db_session: Test database session
814835
mocker: pytest-mock fixture
836+
837+
Returns:
838+
None
815839
"""
816840
_ = test_config
817841
_ = mock_llama_stack_client
@@ -1151,13 +1175,16 @@ async def test_query_v2_endpoint_rejects_query_when_quota_exceeded(
11511175
- Error response contains appropriate message
11521176
- LLM is not called when quota is exceeded
11531177
1154-
Args:
1178+
Parameters:
11551179
test_config: Test configuration
11561180
mock_llama_stack_client: Mocked Llama Stack client
11571181
test_request: FastAPI request
11581182
test_auth: noop authentication tuple
11591183
patch_db_session: Test database session
11601184
mocker: pytest-mock fixture (to simulate quota exceeded)
1185+
1186+
Returns:
1187+
None
11611188
"""
11621189
_ = test_config
11631190
_ = mock_llama_stack_client

0 commit comments

Comments
 (0)