summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-02 09:21:27 +0200
committerDanilo M. <danix@danix.xyz>2026-07-02 09:21:27 +0200
commit71658d023fdbf60be6b4501372519bf8171d6e13 (patch)
treebf9adcd6bfd60b56303dad219dfe79b003fe0818 /tests
parent166f82d0bfdc598099c088275d68dc42499694f9 (diff)
downloadfirefly-cli-838e43e058a71762cfdde8307c7a42ea37081599.tar.gz
firefly-cli-838e43e058a71762cfdde8307c7a42ea37081599.zip
fix: register cmd_add handler correctly for tx add (v0.3.8)HEADv0.3.8master
v0.3.7 placed the @registry.command decorator above a helper (_resolve_side) inserted between the decorator and cmd_add, so the registry bound the helper as the "tx add" handler. Unit tests call cmd_add directly and missed it; live CLI dispatch failed with "_resolve_side() missing 2 required positional arguments". Move the helper above the decorator and add a regression test asserting the registered handler is cmd_add. Found by live smoke test against the test instance. Also note in resolver that Firefly returns 401 (not 404) for an unknown account id. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_commands_transaction.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/unit/test_commands_transaction.py b/tests/unit/test_commands_transaction.py
index 5f455cb..61a09ab 100644
--- a/tests/unit/test_commands_transaction.py
+++ b/tests/unit/test_commands_transaction.py
@@ -192,6 +192,14 @@ class TestTxAdd(unittest.TestCase):
self.assertEqual(rc, 0)
client.request.assert_not_called() # dry-run wins: no search, no write
+ def test_tx_add_handler_registered_is_cmd_add(self):
+ # Guard the decorator placement: the @registry.command must wrap cmd_add,
+ # not a helper defined between the decorator and the def (a misplacement
+ # unit tests calling cmd_add directly would miss, but CLI dispatch hits).
+ from firefly_cli import registry
+ h = next(c.handler for c in registry.all_commands() if c.name == "tx add")
+ self.assertIs(h, tx.cmd_add)
+
def test_from_id_resolves_by_id_not_name(self):
# --to-id targets an ambiguous account by numeric id (ISSUES.md #2).
ctx, client, resolver = make_ctx()