Add first failing test

This commit is contained in:
Colin Goutte 2021-09-22 10:33:06 +02:00
parent f540fd07df
commit 385cfd6fd2
2 changed files with 17 additions and 1 deletions

View File

@ -5,7 +5,7 @@ serve:
.ONESHELL:
dev_serve:
poetry run uvicornpapi.main:app --reload
poetry run uvicorn papi.main:app --reload
.ONESHELL:
test:

View File

@ -3,6 +3,22 @@ from fastapi.testclient import TestClient
from papi import __version__
app = FastAPI()
@app.get("/")
async def read_main():
return {"msg": "hello wrold"}
client = TestClient(app)
def test_version():
assert __version__ == "0.1.0"
def test_read_main():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"msg": "Hello World"}