summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_commands_account.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/unit/test_commands_account.py b/tests/unit/test_commands_account.py
index 2c07780..4a01292 100644
--- a/tests/unit/test_commands_account.py
+++ b/tests/unit/test_commands_account.py
@@ -22,11 +22,25 @@ class TestAccountCmd(unittest.TestCase):
ctx, client, resolver = make_ctx()
resolver.account.return_value = {"id": "3", "name": "Checking",
"current_balance": "100.00"}
- args = MagicMock(account="Checking")
+ args = MagicMock(account="Checking", at=None)
rc = acct.cmd_balance(args, ctx)
resolver.account.assert_called_once_with("Checking")
+ client.request.assert_not_called() # current balance from resolver, no extra call
self.assertEqual(rc, 0)
+ def test_balance_at_date_fetches_dated_account(self):
+ ctx, client, resolver = make_ctx()
+ resolver.account.return_value = {"id": "3", "name": "Checking",
+ "current_balance": "100.00"}
+ client.request.return_value = {"data": {"id": "3", "attributes": {
+ "name": "Checking", "current_balance": "42.00"}}}
+ args = MagicMock(account="Checking", at="2026-05-31")
+ rc = acct.cmd_balance(args, ctx)
+ self.assertEqual(rc, 0)
+ method, path = client.request.call_args[0][:2]
+ self.assertEqual((method, path), ("GET", "/api/v1/accounts/3"))
+ self.assertEqual(client.request.call_args[1]["params"], {"date": "2026-05-31"})
+
class TestAccountCreate(unittest.TestCase):
def _args(self, **kw):
base = dict(name=None, type=None, opening_balance=None, currency=None)