style: Apply Black formatting to modified files

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-08 08:16:54 +00:00
parent 0a461343e7
commit 78004cd9a4
5 changed files with 280 additions and 285 deletions
+16 -15
View File
@@ -1,6 +1,7 @@
"""
Integration tests for API endpoints.
"""
import pytest
from fastapi.testclient import TestClient
@@ -8,47 +9,47 @@ from fastapi.testclient import TestClient
@pytest.mark.integration
class TestHealthEndpoints:
"""Tests for health check and status endpoints."""
def test_root_endpoint(self, client: TestClient):
"""Test that root endpoint redirects to UI or setup wizard."""
response = client.get("/", follow_redirects=False)
# Accept 200 (OK), 303 (setup wizard redirect), 307/308 (other redirects)
assert response.status_code in [200, 303, 307, 308]
def test_root_redirects_to_setup_wizard_when_setup_required(self, client: TestClient):
"""Test that GET / redirects to setup wizard when setup is required."""
# With test env vars (OPENAI_API_KEY=test-key, AZURE_AI_KEY=test-key),
# is_setup_required() returns True, so we should get a redirect to /setup
response = client.get("/", follow_redirects=False)
# Should return 303 See Other (setup wizard redirect)
assert response.status_code == 303
# Location header should point to setup wizard
assert "Location" in response.headers
assert response.headers["Location"] == "/setup?step=1"
def test_root_returns_200_when_setup_complete(self, client: TestClient):
"""Test that GET /?setup=complete bypasses the setup wizard check."""
# The ?setup=complete query param should bypass the wizard check
response = client.get("/?setup=complete", follow_redirects=False)
# Should return 200 OK (renders the index page)
assert response.status_code == 200
def test_setup_wizard_page_accessible(self, client: TestClient):
"""Test that GET /setup?step=1 returns 200."""
response = client.get("/setup?step=1")
# Setup wizard page should be accessible
assert response.status_code == 200
def test_docs_endpoint(self, client: TestClient):
"""Test that API documentation is accessible."""
response = client.get("/docs")
assert response.status_code == 200
assert "swagger" in response.text.lower() or "openapi" in response.text.lower()
def test_openapi_schema(self, client: TestClient):
"""Test that OpenAPI schema is accessible."""
response = client.get("/openapi.json")
@@ -62,7 +63,7 @@ class TestHealthEndpoints:
@pytest.mark.integration
class TestFileEndpoints:
"""Tests for file management endpoints."""
def test_list_files_empty(self, client: TestClient):
"""Test listing files when database is empty."""
response = client.get("/api/files")
@@ -73,7 +74,7 @@ class TestFileEndpoints:
assert "pagination" in data
assert isinstance(data["files"], list)
assert len(data["files"]) == 0
def test_get_nonexistent_file(self, client: TestClient):
"""Test getting a file that doesn't exist."""
response = client.get("/api/files/99999")
@@ -84,7 +85,7 @@ class TestFileEndpoints:
@pytest.mark.requires_external
class TestProcessingEndpoints:
"""Tests for document processing endpoints."""
def test_process_endpoint_exists(self, client: TestClient):
"""Test that process endpoint is registered."""
# This will return 422 (validation error) without proper data,
@@ -96,7 +97,7 @@ class TestProcessingEndpoints:
@pytest.mark.integration
class TestConfigEndpoints:
"""Tests for configuration endpoints."""
def test_config_status_endpoint(self, client: TestClient):
"""Test configuration status endpoint if it exists."""
# Some apps have a /status or /config/status endpoint
@@ -108,7 +109,7 @@ class TestConfigEndpoints:
@pytest.mark.integration
class TestAuthEndpoints:
"""Tests for authentication endpoints (when auth is disabled in tests)."""
def test_unauthenticated_access_with_auth_disabled(self, client: TestClient):
"""Test that API is accessible when auth is disabled."""
# With AUTH_ENABLED=False, API should be accessible