From 726bc11fe7b19581657cd555aa3b3f8741a7eb64 Mon Sep 17 00:00:00 2001 From: James Briggs <35938317+jamescalam@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:47:11 +0100 Subject: [PATCH] add placeholder api key --- tests/unit/test_layer.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/unit/test_layer.py b/tests/unit/test_layer.py index f94c84d0..3a4adcc7 100644 --- a/tests/unit/test_layer.py +++ b/tests/unit/test_layer.py @@ -174,27 +174,26 @@ class TestRouteLayer: assert route_layer.score_threshold == 0.82 def test_json(self, openai_encoder, routes): + os.environ["OPENAI_API_KEY"] = "test_api_key" route_layer = RouteLayer(encoder=openai_encoder, routes=routes) route_layer.to_json("test_output.json") assert os.path.exists("test_output.json") - with patch("semantic_router.encoders.OpenAIEncoder", new_callable=Mock): - route_layer_from_file = RouteLayer.from_json("test_output.json") - assert ( - route_layer_from_file.index is not None - and route_layer_from_file.categories is not None - ) + route_layer_from_file = RouteLayer.from_json("test_output.json") + assert ( + route_layer_from_file.index is not None + and route_layer_from_file.categories is not None + ) os.remove("test_output.json") def test_yaml(self, openai_encoder, routes): route_layer = RouteLayer(encoder=openai_encoder, routes=routes) route_layer.to_yaml("test_output.yaml") assert os.path.exists("test_output.yaml") - with patch("semantic_router.encoders.OpenAIEncoder", new_callable=Mock): - route_layer_from_file = RouteLayer.from_yaml("test_output.yaml") - assert ( - route_layer_from_file.index is not None - and route_layer_from_file.categories is not None - ) + route_layer_from_file = RouteLayer.from_yaml("test_output.yaml") + assert ( + route_layer_from_file.index is not None + and route_layer_from_file.categories is not None + ) os.remove("test_output.yaml") def test_config(self, openai_encoder, routes): -- GitLab