TP_JO2024/athlete/tests/test_getAthlete.py

18 lines
499 B
Python
Raw Permalink Normal View History

2024-03-27 14:17:05 +01:00
from athlete import Athlete
def test_getAthlete(client):
response = client.get("/1")
# Check if can be mapped to Athlete RootModel object
2024-03-27 11:18:57 +01:00
2024-03-27 14:17:05 +01:00
athlete = Athlete(
id=1,
prenom="Teddy",
nom="Riner",
pays="France",
sexe="H",
image="https://upload.wikimedia.org/wikipedia/commons/4/4e/Teddy_Riner_2012.jpg",
disciplines=[1],
records=[],
)
assert athlete.model_dump() == response.json
assert response.status_code == 200