"""Tests for the main FastAPI application.""" import pytest from fastapi.testclient import TestClient from src.kybtech_dots_ocr.app import app client = TestClient(app) def test_health_check(): """Test the health check endpoint.""" response = client.get("/health") assert response.status_code == 200 data = response.json() assert "status" in data assert "version" in data def test_ocr_endpoint_missing_file(): """Test OCR endpoint with missing file.""" response = client.post("/v1/id/ocr") assert response.status_code == 422 # Validation error def test_ocr_endpoint_invalid_file(): """Test OCR endpoint with invalid file.""" files = {"file": ("test.txt", b"not an image", "text/plain")} response = client.post("/v1/id/ocr", files=files) # Should handle gracefully assert response.status_code in [400, 422, 500] @pytest.mark.skip(reason="Requires model to be loaded") def test_ocr_endpoint_with_image(): """Test OCR endpoint with actual image (requires model).""" # This test would require the model to be loaded # and actual image data pass