mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
backend/tests/: 33 pytest tests against a real Postgres database (aurum_test, created/migrated/dropped per run) exercised through the actual HTTP API — not sqlite, not mocks, and the real `aurum` database is never opened (app lifespan is skipped, get_session is overridden per test). Covers transaction category-kind validation, year/month/date-range filtering and pagination, dashboard summary arithmetic, budget status, cash flow, and the /transactions/years picker. e2e/: 6 Playwright specs driving a real browser against a fully separate throwaway docker-compose stack (run.sh: separate project name, database, port, and volume, torn down with `down -v` on exit) — regression coverage for the Recent Transactions month bug, the Card grid-overflow bug, the frozen-year bug, the Net Worth default range, and the Dashboard-> Transactions deep link, all fixed earlier this session. Also synced the backend's APP_VERSION constant (stale at 0.15.2, embedded in exported backups) with the frontend version.
23 lines
692 B
Python
23 lines
692 B
Python
"""Shared test fixtures' plain-Python helpers (not pytest fixtures
|
|
themselves — those live in conftest.py)."""
|
|
from decimal import Decimal
|
|
|
|
|
|
def money(value) -> Decimal:
|
|
"""Compares amounts by value regardless of whether the API serializes
|
|
Decimal as a JSON string or number — that's a wire-format detail, not
|
|
business behavior worth pinning a test to."""
|
|
return Decimal(str(value))
|
|
|
|
|
|
def txn_payload(account_id: int, **overrides) -> dict:
|
|
payload = {
|
|
"account_id": account_id,
|
|
"type": "expense",
|
|
"amount": "10.00",
|
|
"description": "test transaction",
|
|
"date": "2026-01-15",
|
|
}
|
|
payload.update(overrides)
|
|
return payload
|