add "debit_card" as a new AccountType (#16)

This commit is contained in:
whaley
2026-09-08 20:03:13 +03:00
committed by GitHub
parent ae89311a8e
commit 12c3a7d79c
10 changed files with 69 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
"""Account-type behavior shared by the accounts API and financial summaries."""
from datetime import date
from httpx import AsyncClient
from tests.helpers import money, txn_payload
async def test_debit_card_is_a_liquid_account_type(client: AsyncClient, categories):
response = await client.post(
"/accounts",
json={"name": "Debit card", "type": "debit_card", "currency": "RUB"},
)
assert response.status_code == 201
debit_card = response.json()
assert debit_card["type"] == "debit_card"
transaction = await client.post(
"/transactions",
json=txn_payload(
debit_card["id"],
type="income",
amount="1000.00",
category_id=categories["Salary"]["id"],
date=date.today().isoformat(),
),
)
assert transaction.status_code == 201
summary = await client.get("/net-worth/summary", params={"range": "all"})
assert summary.status_code == 200
assert money(summary.json()["current"]) == money("1000.00")