Inital commit
This commit is contained in:
0
app/__init__.py
Normal file
0
app/__init__.py
Normal file
8
app/main.py
Executable file
8
app/main.py
Executable file
@@ -0,0 +1,8 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def read_main():
|
||||
return {"msg": "Hello World"}
|
4
app/test/__init__.py
Normal file
4
app/test/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
10
app/test/test_main.py
Normal file
10
app/test/test_main.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from fastapi.testclient import TestClient
|
||||
import app.main
|
||||
|
||||
client = TestClient(app.main.app)
|
||||
|
||||
|
||||
def test_read_main():
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"msg": "Hello World"}
|
Reference in New Issue
Block a user