Skip to content

Commit

Permalink
test: add basic test for FastAPI root endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcyi committed Oct 21, 2024
1 parent 569f1cc commit eaa32ba
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_main.py
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"}



0 comments on commit eaa32ba

Please sign in to comment.