From 4c71a39489c9fed82a02cc8abb735518d3ef314f Mon Sep 17 00:00:00 2001 From: Homayed Date: Sun, 28 Jun 2026 22:59:25 +0100 Subject: [PATCH] Add backend endpoint tests --- backend/requirements.txt | 8 ++++++++ backend/tests/test_main.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 backend/tests/test_main.py diff --git a/backend/requirements.txt b/backend/requirements.txt index 2ef6c2c..335bd34 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,12 +1,20 @@ annotated-doc==0.0.4 annotated-types==0.7.0 anyio==4.14.1 +certifi==2026.6.17 click==8.4.2 fastapi==0.138.1 h11==0.16.0 +httpcore==1.0.9 +httpx==0.28.1 idna==3.18 +iniconfig==2.3.0 +packaging==26.2 +pluggy==1.6.0 pydantic==2.13.4 pydantic_core==2.46.4 +Pygments==2.20.0 +pytest==9.1.1 starlette==1.3.1 typing-inspection==0.4.2 typing_extensions==4.15.0 diff --git a/backend/tests/test_main.py b/backend/tests/test_main.py new file mode 100644 index 0000000..7e36664 --- /dev/null +++ b/backend/tests/test_main.py @@ -0,0 +1,19 @@ +from fastapi.testclient import TestClient + +from main import app + +client = TestClient(app) + +def test_home(): + response = client.get("/") + assert response.status_code == 200 + assert response.json() == { + "message": "Hello" + } + +def test_health(): + response = client.get("/health") + assert response.status_code == 200 + assert response.json() == { + "status": "ok" + } \ No newline at end of file