-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add basic test for FastAPI root endpoint
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import sys | ||
import os | ||
import pytest | ||
from httpx import AsyncClient | ||
|
||
# Add the project root directory to the Python path | ||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | ||
|
||
from app.main import app # Import your FastAPI app | ||
|
||
@pytest.mark.asyncio | ||
async def test_read_root(): | ||
async with AsyncClient(app=app, base_url="http://test") as ac: | ||
response = await ac.get("/") | ||
assert response.status_code == 200 | ||
assert response.json() == {"message": "Welcome to the Secure Healthcare Data Pipeline API"} | ||
|
||
|
||
|