Skip to content

Commit

Permalink
update test client usage with fastapi update
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-tuli committed Apr 26, 2024
1 parent aa71741 commit 7f903a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/deepsparse/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
)
Expand Down
7 changes: 4 additions & 3 deletions tests/server/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 7f903a8

Please sign in to comment.