Skip to content

Commit 123f130

Browse files
committed
update tests with pr review comments
Signed-off-by: Jordan Dubrick <jdubrick@redhat.com>
1 parent 1a0dd23 commit 123f130

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/unit/app/endpoints/test_shields.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ async def test_shields_endpoint_llama_stack_connection_error(
250250
251251
Simulates the Llama Stack client raising an APIConnectionError and asserts
252252
that calling the endpoint raises an HTTPException with status 503, a detail
253-
response of "Service unavailable", and a detail cause that contains "Unable
254-
to connect to Llama Stack".
253+
response of "Unable to connect to Llama Stack", and a detail cause that
254+
contains "Connection error".
255255
"""
256256
mock_authorization_resolvers(mocker)
257257

@@ -291,6 +291,8 @@ async def test_shields_endpoint_llama_stack_connection_error(
291291
cfg = AppConfig()
292292
cfg.init_from_dict(config_dict)
293293

294+
mocker.patch("app.endpoints.shields.configuration", cfg)
295+
294296
request = Request(
295297
scope={
296298
"type": "http",
@@ -475,10 +477,10 @@ async def test_shields_endpoint_handler_malformed_shield_objects(
475477

476478
mock_client = mocker.AsyncMock()
477479
mock_client.shields.list.return_value = [mock_shield_minimal]
478-
mock_lsc = mocker.patch("client.AsyncLlamaStackClientHolder.get_client")
479-
mock_lsc.return_value = mock_client
480-
mock_config = mocker.Mock()
481-
mocker.patch("app.endpoints.shields.configuration", mock_config)
480+
mock_client_holder = mocker.patch(
481+
"app.endpoints.shields.AsyncLlamaStackClientHolder"
482+
)
483+
mock_client_holder.return_value.get_client.return_value = mock_client
482484

483485
request = Request(
484486
scope={

0 commit comments

Comments
 (0)