Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

791 B
Raw Blame
"""
AngelaMos | 2026
conftest.py

Shared pytest fixtures for the backend test suite

Provides two fixtures: tmp_db_path supplies a temp SQLite path for
test isolation, and test_settings builds a Settings instance pointed
at that path with a known XOR key.
"""

from pathlib import Path

import pytest

from config import Settings


@pytest.fixture
def tmp_db_path(tmp_path: Path) -> Path:
    """
    Provide a temporary database path for test isolation
    """
    return tmp_path / "test_c2.db"


@pytest.fixture
def test_settings(tmp_db_path: Path) -> Settings:
    """
    Settings override pointing to a temporary database
    """
    return Settings(
        DATABASE_PATH=tmp_db_path,
        XOR_KEY="test-xor-key-12345",
        ENVIRONMENT="development",
        DEBUG=True,
    )