mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
add "debit_card" as a new AccountType (#16)
This commit is contained in:
34
backend/tests/test_accounts.py
Normal file
34
backend/tests/test_accounts.py
Normal 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")
|
||||
Reference in New Issue
Block a user