From 7f903a8d7b0ab9188fc1e216e4fb32506b99c0eb Mon Sep 17 00:00:00 2001 From: Rahul Tuli Date: Fri, 26 Apr 2024 17:04:12 +0000 Subject: [PATCH] update test client usage with fastapi update --- src/deepsparse/server/config.py | 2 +- tests/server/test_endpoints.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/deepsparse/server/config.py b/src/deepsparse/server/config.py index b1788fb425..7b39b5798b 100644 --- a/src/deepsparse/server/config.py +++ b/src/deepsparse/server/config.py @@ -168,7 +168,7 @@ class ServerConfig(BaseModel): default=None, ) - integration: str = Field( + integration: Optional[str] = Field( default=None, description=f"The kind of integration to use. {INTEGRATIONS}", ) diff --git a/tests/server/test_endpoints.py b/tests/server/test_endpoints.py index 95b8b5957e..3632de48d5 100644 --- a/tests/server/test_endpoints.py +++ b/tests/server/test_endpoints.py @@ -67,7 +67,7 @@ def test_docs_exist(self, client): def test_home_redirects_to_docs(self, client): response = client.get("/") assert response.status_code == 200 - assert response.request.path_url == "/docs" + assert str(response.request.url).endswith("/docs") assert len(response.history) > 0 assert response.history[-1].is_redirect @@ -295,13 +295,14 @@ def test_dynamic_add_and_remove_endpoint(engine_mock): assert response.status_code == 200 # remove /predict - response = client.delete( + response = client.request( + "DELETE", "/endpoints", json=EndpointConfig( route="/v2/models/test_model/infer", task="text-classification", model="default", - ).dict(), + ).model_dump(), ) assert response.status_code == 200 assert 404 == client.post("/predict", json=dict(sequences="asdf")).status_code