From ef66f332efd861a3882c42b88e55ee6c07ae9210 Mon Sep 17 00:00:00 2001 From: "Obi.M" Date: Fri, 21 Feb 2025 01:12:32 +0100 Subject: [PATCH] feat: commit that fails --- tests/test_fail.py | 18 ++++++++++++++++++ tests/test_success.py | 17 ----------------- 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 tests/test_fail.py delete mode 100644 tests/test_success.py diff --git a/tests/test_fail.py b/tests/test_fail.py new file mode 100644 index 0000000..78acee9 --- /dev/null +++ b/tests/test_fail.py @@ -0,0 +1,18 @@ +from fastapi.testclient import TestClient +from main import app + +client = TestClient(app) + + +def test_failing_root(): + # This will fail because of the wrong expected message + response = client.get("/") + assert response.status_code == 200 + assert response.json() == {"message": "Wrong Message"} + + +def test_failing_item(): + # This will fail because of the missing field assertion + response = client.get("/items/99") + assert response.status_code == 200 + assert "nonexistent_field" in response.json() diff --git a/tests/test_success.py b/tests/test_success.py deleted file mode 100644 index 54a7c96..0000000 --- a/tests/test_success.py +++ /dev/null @@ -1,17 +0,0 @@ -from fastapi.testclient import TestClient -from main import app - -client = TestClient(app) - -def test_read_root(): - response = client.get("/") - assert response.status_code == 200 - assert response.json() == {"message": "Hello World"} - -def test_read_item(): - response = client.get("/items/42") - assert response.status_code == 200 - assert response.json() == { - "item_id": 42, - "message": "Item details" - }