6ede33ccdb
Build and Push Docker Images / create_manifest (web, surfsense-web, , cpu) (push) Has been cancelled
Build and Push Docker Images / finalize_release (push) Has been cancelled
Obsidian Plugin Lint / lint (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_web, cpu, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64, , runner, false, cpu) (push) Has been cancelled
Build and Push Docker Images / compute_version (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cpu, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, , production, false, cpu) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu126, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda126, production, true, cuda126) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / build (./surfsense_backend, cu128, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64, -cuda, production, true, cuda) (push) Has been cancelled
Build and Push Docker Images / verify_digests (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, , cpu) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda, cuda) (push) Has been cancelled
Build and Push Docker Images / create_manifest (backend, surfsense-backend, -cuda126, cuda126) (push) Has been cancelled
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
"""Root conftest — shared fixtures available to all test modules."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
_DEFAULT_TEST_DB = (
|
|
"postgresql+asyncpg://postgres:postgres@localhost:5432/surfsense_test"
|
|
)
|
|
TEST_DATABASE_URL = os.environ.get("TEST_DATABASE_URL", _DEFAULT_TEST_DB)
|
|
|
|
# Force the app to use the test database regardless of any pre-existing
|
|
# DATABASE_URL in the environment (e.g. from .env or shell profile).
|
|
os.environ["DATABASE_URL"] = TEST_DATABASE_URL
|
|
|
|
# Integration tests authenticate over HTTP via email/password, so the
|
|
# password-auth routers must be mounted (they are skipped under AUTH_TYPE=GOOGLE).
|
|
# setdefault (not load_dotenv, which runs later with override=False) lets a
|
|
# developer's .env=GOOGLE be overridden here while still honouring an explicitly
|
|
# exported shell AUTH_TYPE.
|
|
os.environ.setdefault("AUTH_TYPE", "LOCAL")
|
|
os.environ.setdefault("REGISTRATION_ENABLED", "TRUE")
|
|
|
|
import pytest # noqa: E402
|
|
|
|
from app.db import DocumentType # noqa: E402
|
|
from app.indexing_pipeline.connector_document import ConnectorDocument # noqa: E402
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Unit test fixtures
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_user_id() -> str:
|
|
return "00000000-0000-0000-0000-000000000001"
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_workspace_id() -> int:
|
|
return 1
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_connector_id() -> int:
|
|
return 42
|
|
|
|
|
|
@pytest.fixture
|
|
def make_connector_document():
|
|
"""
|
|
Generic factory for unit tests. Overridden in tests/integration/conftest.py
|
|
with real DB-backed IDs for integration tests.
|
|
"""
|
|
|
|
def _make(**overrides):
|
|
defaults = {
|
|
"title": "Test Document",
|
|
"source_markdown": "## Heading\n\nSome content.",
|
|
"unique_id": "test-id-001",
|
|
"document_type": DocumentType.CLICKUP_CONNECTOR,
|
|
"workspace_id": 1,
|
|
"connector_id": 1,
|
|
"created_by_id": "00000000-0000-0000-0000-000000000001",
|
|
}
|
|
defaults.update(overrides)
|
|
return ConnectorDocument(**defaults)
|
|
|
|
return _make
|