add test of adding sonde

This commit is contained in:
Colin Goutte 2021-09-22 11:29:58 +02:00
parent ab5d69e44d
commit 546733d998
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,8 @@ from fastapi import FastAPI
app = FastAPI()
sondes = []
class Sonde(BaseModel):
identifiant: str

View File

@ -3,6 +3,8 @@ from fastapi.testclient import TestClient
from papi.main import app
from papi.main import sondes
from papi import __version__
client = TestClient(app)
@ -22,3 +24,4 @@ def test_creer_sonde():
sonde1 = {"identifiant": "masonde_001", "nom": "client1"}
response = client.post("/sonde/", json=sonde1)
assert response.status_code == 200
assert sonde1 in sondes