Adding first test

master
Drew Bednar 4 years ago
parent 4a74c8ebb7
commit fe6cb532d1

@ -7,4 +7,4 @@ app = FastAPI()
@app.get('/ping')
def pong():
now = dt.datetime.now(dt.timezone.utc)
return {"ping": "pong!", "now": now}
return {'ping': "pong!", 'now': now}

@ -0,0 +1,11 @@
from app.main import app
from starlette.testclient import TestClient
client = TestClient(app)
def test_read_main():
response = client.get('/ping')
assert response.status_code == 200
data = response.json()
assert "pong" in data['ping']
Loading…
Cancel
Save