Skip to content

Commit

Permalink
add tests for response status code
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Jan 5, 2024
1 parent e631564 commit ecb1f60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions jhub_apps/service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ async def start_server(
server_name=None,
user: User = Depends(get_current_user),
):
"""Start an already existing server."""
hub_client = HubClient()
response = hub_client.start_server(
username=user.name,
Expand Down
5 changes: 5 additions & 0 deletions jhub_apps/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_api_get_server(get_user, client):
get_user.return_value = create_server_response
response = client.get("/server/panel-app")
get_user.assert_called_once_with(MOCK_USER.name)
assert response.status_code == 200
assert response.json() == server_data["panel-app"]


Expand All @@ -56,6 +57,7 @@ def test_api_create_server(create_server, client):
servername="panel-app",
user_options=final_user_options,
)
assert response.status_code == 200
assert response.json() == create_server_response


Expand Down Expand Up @@ -105,6 +107,7 @@ def test_api_delete_server(delete_server, name, remove, client):
server_name="panel-app",
remove=remove
)
assert response.status_code == 200
assert response.json() == create_server_response


Expand All @@ -130,6 +133,7 @@ def test_api_update_server(create_server, client):
edit=True,
user_options=final_user_options,
)
assert response.status_code == 200
assert response.json() == create_server_response


Expand All @@ -147,4 +151,5 @@ def test_api_status(client):
response = client.get(
"/status",
)
assert response.status_code == 200
assert response.json() == {"status": "ok"}

0 comments on commit ecb1f60

Please sign in to comment.