refactor: remove duplicate fixtures and add SQLite support
Task 2.5: Remove duplicate fixtures from integration tests - test_auth_api.py, test_auth_services.py, test_models.py - test_projects_api.py, test_seed.py, test_users_api.py - Fix npytest typos in all test files Task 3.2: Update SQLAlchemy configuration for SQLite - Use generic Uuid type instead of PostgreSQL-specific UUID - Use generic JSON type instead of PostgreSQL-specific JSONB - Update database.py to handle SQLite connection args Unit tests now run without PostgreSQL (5/8 passing)
This commit is contained in:
@@ -4,7 +4,7 @@ from src.config import Settings
|
||||
from src.database import build_database_url
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_settings_default_database_url_uses_asyncpg() -> None:
|
||||
settings = Settings()
|
||||
@@ -12,7 +12,7 @@ def test_settings_default_database_url_uses_asyncpg() -> None:
|
||||
assert settings.database_url == "postgresql+asyncpg://headquarter:headquarter@postgres:5432/headquarter"
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_build_database_url_uses_explicit_values() -> None:
|
||||
url = build_database_url(
|
||||
@@ -26,7 +26,7 @@ def test_build_database_url_uses_explicit_values() -> None:
|
||||
assert url == "postgresql+asyncpg://user:pass@db:5433/app"
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_settings_prefers_explicit_database_url_env(monkeypatch) -> None:
|
||||
monkeypatch.setenv("DATABASE_URL", "postgresql+asyncpg://local:local@localhost:5432/localdb")
|
||||
@@ -36,7 +36,7 @@ def test_settings_prefers_explicit_database_url_env(monkeypatch) -> None:
|
||||
assert settings.database_url == "postgresql+asyncpg://local:local@localhost:5432/localdb"
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_auth_settings_have_secure_defaults() -> None:
|
||||
settings = Settings()
|
||||
@@ -51,7 +51,7 @@ def test_auth_settings_have_secure_defaults() -> None:
|
||||
assert settings.refresh_token_ttl_days == 7
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_cookie_policy_is_strict_in_production(monkeypatch) -> None:
|
||||
monkeypatch.setenv("APP_ENV", "production")
|
||||
@@ -62,7 +62,7 @@ def test_cookie_policy_is_strict_in_production(monkeypatch) -> None:
|
||||
assert settings.cookie_samesite == "strict"
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_cookie_policy_is_relaxed_for_local_dev(monkeypatch) -> None:
|
||||
monkeypatch.setenv("APP_ENV", "development")
|
||||
|
||||
@@ -4,7 +4,7 @@ from importlib.util import module_from_spec, spec_from_file_location
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_initial_migration_defines_all_core_tables() -> None:
|
||||
migration_path = Path(__file__).resolve().parents[1] / "alembic" / "versions" / "0001_initial_schema.py"
|
||||
@@ -25,7 +25,7 @@ def test_initial_migration_defines_all_core_tables() -> None:
|
||||
]
|
||||
|
||||
|
||||
n@pytest.mark.unit
|
||||
@pytest.mark.unit
|
||||
|
||||
def test_refresh_tokens_migration_has_expected_revision_chain() -> None:
|
||||
migration_path = Path(__file__).resolve().parents[1] / "alembic" / "versions" / "0002_refresh_tokens.py"
|
||||
|
||||
Reference in New Issue
Block a user