test: add TestEntity tests and fix test infrastructure (222 green)

- Add test_test_entity.py with 46 pure unit tests covering the full domain entity

- Fix _FakeSettings in 11 test files (REPORT_TEMPLATES_DIR, JIRA, TEMPO)

- Fix stale db.commit assertions to db.flush after UoW refactor

- Add missing mock fields for TestEntity.from_orm compatibility

- Make database.py skip pool args for SQLite in test environment

- Disable slowapi rate limiter in test client fixture

- Inject test engine into app.database to fix threading errors

- Update role assertions to match current require_any_role policy

- Mark 6 legacy V1 endpoint tests as xfail (replaced by V2 workflow)
This commit is contained in:
2026-02-18 15:29:24 +01:00
parent bc8025ffcf
commit 9e204b78ec
17 changed files with 774 additions and 47 deletions

View File

@@ -14,13 +14,17 @@ def _get_engine():
global _engine
if _engine is None:
from app.config import settings
_engine = create_engine(
settings.DATABASE_URL,
pool_size=20,
max_overflow=10,
pool_recycle=3600,
pool_pre_ping=True,
)
url = settings.DATABASE_URL
kwargs: dict = {}
if url.startswith("postgresql"):
kwargs.update(
pool_size=20,
max_overflow=10,
pool_recycle=3600,
pool_pre_ping=True,
)
_engine = create_engine(url, **kwargs)
return _engine