19 lines
497 B
Python
19 lines
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()
|