From ac8d8c071f1eb26d92f1160dfe6cec5dcd62b408 Mon Sep 17 00:00:00 2001 From: David Tam Date: Fri, 16 Aug 2024 10:30:33 -0700 Subject: [PATCH] fix tests --- tests/blueprints/test_guards.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/blueprints/test_guards.py b/tests/blueprints/test_guards.py index 062a458..3cce59d 100644 --- a/tests/blueprints/test_guards.py +++ b/tests/blueprints/test_guards.py @@ -634,10 +634,11 @@ def test_openai_v1_chat_completions__raises_404(mocker): return_value=mock_guard, ) mocker.patch("guardrails_api.blueprints.guards.CacheClient.set") - # expect 404 HttpError - with pytest.raises(Exception) as e: - openai_v1_chat_completions("My%20Guard's%20Name") - assert str(e.value) == '404 Not Found: Guard not found' + + response = openai_v1_chat_completions("My%20Guard's%20Name") + assert response[1] == 404 + assert response[0]["message"] == 'NotFound' + mock_get_guard.assert_called_once_with("My Guard's Name")