TP_JO2024/athlete/tests/test_postAthlete.py
2024-03-27 14:17:05 +01:00

19 lines
No EOL
497 B
Python

from athlete import Athlete
def test_postAthlete(client):
athlete = Athlete(
id=1,
prenom="Jean",
nom="Dupont",
pays="URSS",
sexe="H",
image="http://demo.example",
disciplines=[0],
records=[1],
)
response = client.post("/", json=athlete.model_dump())
assert response.status_code == 200
athlete.id = response.json["id"]
response = client.get(f"/{athlete.id}")
assert response.json == athlete.model_dump()