synthex / tests /test_integration.py
theaniketgiri's picture
backend
3f61e65
import pytest
from fastapi.testclient import TestClient
from app.main import app
client = TestClient(app)
def test_beta_verification():
response = client.post("/api/beta/verify", json={"application_id": "test123"})
assert response.status_code == 200
assert response.json()["message"] == "Access granted"
def test_jwt_authentication():
response = client.post("/api/auth/token", data={"username": "admin@synthex.com", "password": "admin123"})
assert response.status_code == 200
assert "access_token" in response.json()
def test_record_generation():
# First, get a token
token_response = client.post("/api/auth/token", data={"username": "admin@synthex.com", "password": "admin123"})
token = token_response.json()["access_token"]
# Then, generate records
response = client.post(
"/api/generator/generate",
json={"recordType": "Clinical Note", "quantity": 5},
headers={"Authorization": f"Bearer {token}"}
)
assert response.status_code == 200
assert len(response.json()) == 5