mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-28 10:49:33 -04:00
✅ Improve test debugging (#1222)
This commit is contained in:
@@ -113,7 +113,7 @@ openapi_schema = {
|
||||
def test_openapi_schema():
|
||||
with TestClient(app) as client:
|
||||
response = client.get("/openapi.json")
|
||||
assert response.status_code == 200
|
||||
assert response.status_code == 200, response.text
|
||||
assert response.json() == openapi_schema
|
||||
|
||||
|
||||
@@ -121,11 +121,11 @@ def test_create_read():
|
||||
with TestClient(app) as client:
|
||||
note = {"text": "Foo bar", "completed": False}
|
||||
response = client.post("/notes/", json=note)
|
||||
assert response.status_code == 200
|
||||
assert response.status_code == 200, response.text
|
||||
data = response.json()
|
||||
assert data["text"] == note["text"]
|
||||
assert data["completed"] == note["completed"]
|
||||
assert "id" in data
|
||||
response = client.get(f"/notes/")
|
||||
assert response.status_code == 200
|
||||
assert response.status_code == 200, response.text
|
||||
assert data in response.json()
|
||||
|
||||
Reference in New Issue
Block a user