Test routing ok

This commit is contained in:
Colin Goutte 2021-09-29 15:34:25 +02:00
parent e09f161b97
commit adb69278c8
2 changed files with 10 additions and 4 deletions

View File

@ -72,11 +72,16 @@ def list_sonde():
return [x for x in sondes.values()]
@app.get("/notifications/{idsonde}/")
@app.get("/notifications/{idsonde}")
def list_notification(idsonde: str):
return notifications[idsonde][::-1]
@app.get("/notifications/{idsonde}/text")
def list_notification_as_text(idsonde: str):
return "Contenu"
@app.post("/sonde/{idsonde}/")
def post_sonde_data(
idsonde: str, body: dict = Body(...), db: Session = Depends(get_db)

View File

@ -149,10 +149,11 @@ def test_onchange_notification():
def test_template_rendering():
id_sonde = "masonde_histo"
notifs_text = client.get(f"/notifications/{idsonde}.txt")
idsonde = "masonde_histo"
notifs_text = client.get(f"/notifications/{idsonde}/text")
assert notifs_text.ok
# assert something in notif_text.body ?
content = notifs_text
assert "contenu" in content.text.lower()
class CodeCoverageTestCase(TestCase):