diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-30 11:04:38 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-30 11:04:38 +0200 |
| commit | 28bde5b10abf904212dfc3cae937112134293053 (patch) | |
| tree | b12aba30abeaba15a10458032e11e7d01cb69bd2 /tests/unit | |
| parent | 49c9af4c213d5f420a405d860c0454fade26c297 (diff) | |
| download | firefly-cli-28bde5b10abf904212dfc3cae937112134293053.tar.gz firefly-cli-28bde5b10abf904212dfc3cae937112134293053.zip | |
feat: account, category, tag, auth commands
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/test_commands_account.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/unit/test_commands_account.py b/tests/unit/test_commands_account.py new file mode 100644 index 0000000..4d28802 --- /dev/null +++ b/tests/unit/test_commands_account.py @@ -0,0 +1,27 @@ +import unittest +from unittest.mock import MagicMock +from firefly_cli.commands import account as acct +from firefly_cli.context import Context + +def make_ctx(): + client = MagicMock() + resolver = MagicMock() + return Context(client=client, resolver=resolver, human=False), client, resolver + +class TestAccountCmd(unittest.TestCase): + def test_list_passes_type_filter(self): + ctx, client, _ = make_ctx() + client.request.return_value = {"data": []} + args = MagicMock(type="asset") + acct.cmd_list(args, ctx) + client.request.assert_called_once_with( + "GET", "/api/v1/accounts", params={"type": "asset"}) + + def test_balance_resolves_name_and_returns_balance(self): + ctx, client, resolver = make_ctx() + resolver.account.return_value = {"id": "3", "name": "Checking", + "current_balance": "100.00"} + args = MagicMock(account="Checking") + rc = acct.cmd_balance(args, ctx) + resolver.account.assert_called_once_with("Checking") + self.assertEqual(rc, 0) |
