25 lines
420 B
Python
25 lines
420 B
Python
from fastapi import FastAPI
|
|
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"}
|