From 8cdb1a36fa84f3c362eff7945fb54d5e5091fdd2 Mon Sep 17 00:00:00 2001 From: Rudolf Braun <48672663+BraunRudolf@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:27:32 +0200 Subject: [PATCH] Add test to route / --- backend-app/tests/unit/test_auth.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backend-app/tests/unit/test_auth.py b/backend-app/tests/unit/test_auth.py index a7378dcb..f8dd4d65 100644 --- a/backend-app/tests/unit/test_auth.py +++ b/backend-app/tests/unit/test_auth.py @@ -261,3 +261,22 @@ async def test_get_current_admin_not_active_not_admin( assert exc_info.value.status_code == 400 assert exc_info.value.detail == "Inactive user" + + +def test_api_helth_check(client): + # GET request + response = client.get("/") + assert response.status_code == 200 + assert response.json() == {"Status": "Something Different"} + + +def test_health_check_post(client): + # POST request to a GET-only route + response = client.post("/") + assert response.status_code == 405 # Method Not Allowed + + +def test_health_check_wrong_url(client): + # Wrong URL + response = client.get("/wrong-url") + assert response.status_code == 404 # Not Found