Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Peddle committed Oct 18, 2023
1 parent 16a34c5 commit 8891d93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions potassium/potassium.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def _handle_generic(self, endpoint, flask_request):
res = make_response()
res.status_code = 400
res.headers['X-Endpoint-Type'] = endpoint.type
self._gpu_lock.release()
return res

if endpoint.type == "handler":
Expand Down
8 changes: 8 additions & 0 deletions tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ def handler2_id(context: dict, request: potassium.Request) -> potassium.Response
assert res.status_code == 200
assert res.json == {"hello": "some_path/child_path"}

res = client.post("/", data='{"key": unquoted_value}', content_type='application/json')
assert res.status_code == 400
# check status
res = client.get("/__status__")
assert res.status_code == 200
assert res.json is not None
assert res.json["gpu_available"] == True

# parameterized test for path collisions
@pytest.mark.parametrize("paths", [
("/", "",),
Expand Down

0 comments on commit 8891d93

Please sign in to comment.