import pytest from fastapi.testclient import TestClient from pathlib import Path import tempfile from app.main import app client = TestClient(app) def test_health_check(): """Test health check endpoint""" response = client.get("/api/v1/health") assert response.status_code == 200 data = response.json() assert "status" in data assert "vector_store" in data def test_info_endpoint(): """Test info endpoint""" response = client.get("/info") assert response.status_code == 200 data = response.json() assert "name" in data assert "version" in data def test_query_endpoint(): """Test query endpoint (empty vector store)""" response = client.post("/api/v1/query", json={"question": "test"}) assert response.status_code == 200 data = response.json() assert "answer" in data assert "sources" in data def test_search_endpoint(): """Test search endpoint""" response = client.post("/api/v1/search", json={"query": "test"}) assert response.status_code == 200 data = response.json() assert "results" in data assert "total_results" in data def test_collection_stats(): """Test collection stats endpoint""" response = client.get("/api/v1/collection/stats") assert response.status_code == 200 data = response.json() assert "total_documents" in data # Note: Upload tests would require actual files # Note: TFS sync tests would require TFS configuration if __name__ == "__main__": pytest.main([__file__, "-v"])