Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/integration/endpoints/test_config_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ async def test_config_endpoint_returns_config(
- Real noop authentication is used
- Response structure matches expected format

Args:
test_config: Loads test configuration
test_request: FastAPI request
test_auth: noop authentication tuple
Parameters:
test_config (AppConfig): Fixture providing the expected configuration to be returned.
test_request (Request): FastAPI request object used to call the endpoint.
test_auth (AuthTuple): Authentication fixture used for the request.
"""
response = await config_endpoint_handler(auth=test_auth, request=test_request)

Expand All @@ -47,10 +47,10 @@ async def test_config_endpoint_returns_current_config(
- Real noop authentication is used
- Response structure matches expected format

Args:
current_config: Loads root configuration
test_request: FastAPI request
test_auth: noop authentication tuple
Parameters:
current_config (AppConfig): Loads root configuration
test_request (Request): FastAPI request
test_auth (AuthTuple): noop authentication tuple
"""
response = await config_endpoint_handler(auth=test_auth, request=test_request)

Expand All @@ -69,9 +69,9 @@ async def test_config_endpoint_fails_without_configuration(
- HTTPException is raised when configuration is not loaded
- Error message indicates configuration is not loaded

Args:
test_request: FastAPI request
test_auth: noop authentication tuple
Parameters:
test_request (Request): FastAPI request fixture
test_auth (AuthTuple): noop authentication fixture
"""

# Verify that HTTPException is raised when configuration is not loaded
Expand Down
18 changes: 14 additions & 4 deletions tests/integration/endpoints/test_health_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def mock_llama_stack_client_fixture(

This is the only external dependency we mock for integration tests,
as it represents an external service call.

Returns:
mock_client: An AsyncMock representing the Llama Stack client whose
`inspect.version` returns an empty list.
"""
mock_holder_class = mocker.patch("app.endpoints.health.AsyncLlamaStackClientHolder")

Expand All @@ -50,9 +54,12 @@ async def test_health_liveness(
- Real noop authentication is used
- Response structure matches expected format

Args:
Parameters:
test_config: Loads test configuration
test_auth: noop authentication tuple

Returns:
None
"""
_ = test_config

Expand All @@ -76,7 +83,7 @@ async def test_health_readiness_provider_statuses(
- Provider health status, ID, and error messages are correctly mapped
- Multiple providers with different health states are handled correctly

Args:
Parameters:
mock_llama_stack_client_health: Mocked Llama Stack client
mocker: pytest-mock fixture for creating mock objects
"""
Expand Down Expand Up @@ -130,7 +137,7 @@ async def test_health_readiness_client_error(
- Error propagates from the endpoint handler (desired behavior)
- The endpoint does not catch RuntimeError, only APIConnectionError

Args:
Parameters:
test_response: FastAPI response object
test_auth: noop authentication tuple
"""
Expand All @@ -157,10 +164,13 @@ async def test_health_readiness(
- Real noop authentication is used
- Response structure matches expected format

Args:
Parameters:
mock_llama_stack_client_health: Mocked Llama Stack client
test_response: FastAPI response object
test_auth: noop authentication tuple

Returns:
None
"""
_ = mock_llama_stack_client_health

Expand Down
15 changes: 12 additions & 3 deletions tests/integration/endpoints/test_info_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def mock_llama_stack_client_fixture(

This is the only external dependency we mock for integration tests,
as it represents an external service call.

Parameters:
mocker (pytest_mock.MockerFixture): The pytest-mock fixture used to apply the patch.

Yields:
AsyncMock: A mocked Llama Stack client configured for tests.
"""
mock_holder_class = mocker.patch("app.endpoints.info.AsyncLlamaStackClientHolder")

Expand Down Expand Up @@ -52,11 +58,14 @@ async def test_info_endpoint_returns_service_information(
- Real noop authentication is used
- Response structure matches expected format

Args:
Parameters:
test_config: Loads real configuration (required for endpoint to access config)
mock_llama_stack_client: Mocked Llama Stack client
test_request: FastAPI request
test_auth: noop authentication tuple

Returns:
None
"""
# Fixtures with side effects (needed but not directly used)
_ = test_config
Expand Down Expand Up @@ -87,7 +96,7 @@ async def test_info_endpoint_handles_connection_error(
- HTTPException is raised with correct status code
- Error response includes proper error details

Args:
Parameters:
test_config: Loads real configuration (required for endpoint to access config)
mock_llama_stack_client: Mocked Llama Stack client
test_request: FastAPI request
Expand Down Expand Up @@ -126,7 +135,7 @@ async def test_info_endpoint_uses_configuration_values(
- Endpoint reads configuration values correctly
- Service name from config appears in response

Args:
Parameters:
test_config: Loads real configuration (required for endpoint to access config)
mock_llama_stack_client: Mocked Llama Stack client
test_request: Real FastAPI request
Expand Down
Loading
Loading