Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.1 KB
Raw Blame
"""Tests for FastAPI API v1 router."""

import pytest
from fastapi.testclient import TestClient


@pytest.fixture
def client():
    """Create a FastAPI test client."""
    from local_deep_research.web.fastapi_app import app

    return TestClient(app)


def test_health_endpoint(client):
    """Health endpoint returns 200 with status ok."""
    response = client.get("/api/v1/health")
    assert response.status_code == 200
    data = response.json()
    assert data["status"] == "ok"
    assert "timestamp" in data


def test_root_redirects_to_login(client):
    """Root route redirects unauthenticated users to login."""
    response = client.get("/", follow_redirects=False)
    assert response.status_code == 302
    assert "/auth/login" in response.headers["location"]


def test_api_docs_require_auth(client):
    """API documentation endpoint requires authentication."""
    response = client.get("/api/v1/")
    assert response.status_code == 401


def test_socketio_polling_accessible(client):
    """Socket.IO polling endpoint is accessible."""
    response = client.get("/ws/socket.io/?EIO=4&transport=polling")
    assert response.status_code == 200