File size: 1,061 Bytes
25d0747 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import pytest
import sys
import os
from fastapi.testclient import TestClient
# Add the project root to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from backend.main import app
client = TestClient(app)
def test_root():
response = client.get("/")
assert response.status_code == 200
assert "EMOTIA" in response.json()["message"]
def test_health():
response = client.get("/health")
assert response.status_code == 200
assert response.json()["status"] == "healthy"
def test_analyze_frame_no_data():
response = client.post("/analyze/frame")
assert response.status_code == 422 # Validation error
# Note: For full testing, would need mock data and trained models
# def test_analyze_frame_with_data():
# # Mock image data
# response = client.post("/analyze/frame", files={"image": mock_image})
# assert response.status_code == 200
# data = response.json()
# assert "emotion" in data
# assert "intent" in data
# assert "engagement" in data
# assert "confidence" in data |