feat: commit that fails

This commit is contained in:
Obi.M 2025-02-21 01:12:32 +01:00
parent 03a6160b09
commit ef66f332ef
2 changed files with 18 additions and 17 deletions

18
tests/test_fail.py Normal file
View File

@ -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()

View File

@ -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"
}