From 166f82d0bfdc598099c088275d68dc42499694f9 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 2 Jul 2026 09:10:46 +0200 Subject: feat: tx add --from-id/--to-id to disambiguate same-name accounts (v0.3.7) ISSUES.md #2: two accounts can share a name (e.g. expense id 52 and revenue id 129 both "Nexi"), making --from/--to ambiguous and unresolvable. Add --from-id/--to-id to target an account by numeric id. Per side, exactly one of the name flag or the id flag; sides independent. The id path fetches the account (resolver.account_by_id), validating existence before writing. Name-only callers unchanged; JSON/exit unchanged, so PATCH. Co-Authored-By: Claude Opus 4.8 --- tests/unit/test_resolver.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/unit/test_resolver.py') diff --git a/tests/unit/test_resolver.py b/tests/unit/test_resolver.py index 2e00e83..82ac30b 100644 --- a/tests/unit/test_resolver.py +++ b/tests/unit/test_resolver.py @@ -41,3 +41,13 @@ class TestResolver(unittest.TestCase): r.account("Cash") self.assertIn("3", str(ctx.exception)) self.assertIn("9", str(ctx.exception)) + + def test_account_by_id_fetches_single(self): + c = MagicMock() + c.request.return_value = {"data": { + "id": "129", "type": "accounts", + "attributes": {"name": "Nexi", "type": "revenue"}}} + r = Resolver(c) + acc = r.account_by_id("129") + self.assertEqual(acc, {"id": "129", "name": "Nexi", "type": "revenue"}) + c.request.assert_called_once_with("GET", "/api/v1/accounts/129") -- cgit v1.2.3