44
55import pytest
66from llama_stack .providers .datatypes import HealthStatus
7+ from authentication .interface import AuthTuple
78from app .endpoints .health import (
89 readiness_probe_get_method ,
910 liveness_probe_get_method ,
1415
1516
1617@pytest .mark .asyncio
17- async def test_readiness_probe_fails_due_to_unhealthy_providers (mocker : MockerFixture ):
18+ async def test_readiness_probe_fails_due_to_unhealthy_providers (
19+ mocker : MockerFixture ,
20+ ) -> None :
1821 """Test the readiness endpoint handler fails when providers are unhealthy."""
1922 mock_authorization_resolvers (mocker )
2023
@@ -32,7 +35,9 @@ async def test_readiness_probe_fails_due_to_unhealthy_providers(mocker: MockerFi
3235
3336 # Mock the Response object and auth
3437 mock_response = mocker .Mock ()
35- auth = ("test_user" , "token" , {})
38+
39+ # Authorization tuple required by URL endpoint handler
40+ auth : AuthTuple = ("test_user_id" , "test_user" , True , "test_token" )
3641
3742 response = await readiness_probe_get_method (auth = auth , response = mock_response )
3843
@@ -45,7 +50,7 @@ async def test_readiness_probe_fails_due_to_unhealthy_providers(mocker: MockerFi
4550@pytest .mark .asyncio
4651async def test_readiness_probe_success_when_all_providers_healthy (
4752 mocker : MockerFixture ,
48- ):
53+ ) -> None :
4954 """Test the readiness endpoint handler succeeds when all providers are healthy."""
5055 mock_authorization_resolvers (mocker )
5156
@@ -68,7 +73,9 @@ async def test_readiness_probe_success_when_all_providers_healthy(
6873
6974 # Mock the Response object and auth
7075 mock_response = mocker .Mock ()
71- auth = ("test_user" , "token" , {})
76+
77+ # Authorization tuple required by URL endpoint handler
78+ auth : AuthTuple = ("test_user_id" , "test_user" , True , "test_token" )
7279
7380 response = await readiness_probe_get_method (auth = auth , response = mock_response )
7481 assert response is not None
@@ -80,11 +87,13 @@ async def test_readiness_probe_success_when_all_providers_healthy(
8087
8188
8289@pytest .mark .asyncio
83- async def test_liveness_probe (mocker : MockerFixture ):
90+ async def test_liveness_probe (mocker : MockerFixture ) -> None :
8491 """Test the liveness endpoint handler."""
8592 mock_authorization_resolvers (mocker )
8693
87- auth = ("test_user" , "token" , {})
94+ # Authorization tuple required by URL endpoint handler
95+ auth : AuthTuple = ("test_user_id" , "test_user" , True , "test_token" )
96+
8897 response = await liveness_probe_get_method (auth = auth )
8998 assert response is not None
9099 assert response .alive is True
@@ -93,7 +102,7 @@ async def test_liveness_probe(mocker: MockerFixture):
93102class TestProviderHealthStatus :
94103 """Test cases for the ProviderHealthStatus model."""
95104
96- def test_provider_health_status_creation (self ):
105+ def test_provider_health_status_creation (self ) -> None :
97106 """Test creating a ProviderHealthStatus instance."""
98107 status = ProviderHealthStatus (
99108 provider_id = "test_provider" , status = "ok" , message = "All good"
@@ -102,7 +111,7 @@ def test_provider_health_status_creation(self):
102111 assert status .status == "ok"
103112 assert status .message == "All good"
104113
105- def test_provider_health_status_optional_fields (self ):
114+ def test_provider_health_status_optional_fields (self ) -> None :
106115 """Test creating a ProviderHealthStatus with minimal fields."""
107116 status = ProviderHealthStatus (provider_id = "test_provider" , status = "ok" )
108117 assert status .provider_id == "test_provider"
@@ -113,7 +122,7 @@ def test_provider_health_status_optional_fields(self):
113122class TestGetProvidersHealthStatuses :
114123 """Test cases for the get_providers_health_statuses function."""
115124
116- async def test_get_providers_health_statuses (self , mocker : MockerFixture ):
125+ async def test_get_providers_health_statuses (self , mocker : MockerFixture ) -> None :
117126 """Test get_providers_health_statuses with healthy providers."""
118127 # Mock the imports
119128 mock_lsc = mocker .patch ("client.AsyncLlamaStackClientHolder.get_client" )
@@ -166,7 +175,7 @@ async def test_get_providers_health_statuses(self, mocker: MockerFixture):
166175
167176 async def test_get_providers_health_statuses_connection_error (
168177 self , mocker : MockerFixture
169- ):
178+ ) -> None :
170179 """Test get_providers_health_statuses when connection fails."""
171180 # Mock the imports
172181 mock_lsc = mocker .patch ("client.AsyncLlamaStackClientHolder.get_client" )
0 commit comments