Initial FastAPI application
This commit is contained in:
1 parent
a34e861612
commit
b118e1d539
6 files changed
+98
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_root():
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["message"] == "Hello from FastAPI!"
|
||||
|
||||
|
||||
def test_health():
|
||||
response = client.get("/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"status": "ok"}
|
||||
|
||||
|
||||
def test_hello():
|
||||
response = client.get("/hello/Artem")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"message": "Hello, Artem!"}
|
||||
Reference in new issue
Block a user