diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-15 11:02:34 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-15 11:02:34 +0200 |
| commit | 07f4134d38e53bf6c9235f3ad18dd5b33e89d9ff (patch) | |
| tree | 65eed6420426560a7e8127baa3ea7a703d1223a0 /tests/unit/test_resolver.py | |
| parent | 50cb852130986249cacec411e23392a8610e12f1 (diff) | |
| download | firefly-cli-7d80a77cba738afea1466bbc4cc1dd0f1b54c9fa.tar.gz firefly-cli-7d80a77cba738afea1466bbc4cc1dd0f1b54c9fa.zip | |
New `piggy` group:
- `piggy list` lists piggy banks with saved/target amounts and linked
accounts.
- `piggy add|remove <name|id> <amount> [--account NAME]` changes the
saved amount on a linked account via PUT /piggy-banks/{id}.
Firefly syncs the whole account list on that PUT, so every linked account
is resent (others without current_amount, which keeps their value) or it
would be unlinked. Removing below zero is rejected before any write, and
the saved amount is read back so a refused add fails loudly instead of
returning 200 unchanged.
add/remove currently hit an upstream bug on Firefly III <= 6.7.9:
PiggyBankFactory::linkToAccountIds passes the pivot current_amount (an int
from the DB) to bcsub() uncast, so any PUT with "accounts" 500s
(firefly-iii/firefly-iii#13063). Documented in SKILL.md/README; the live
integration test skips on that error and runs once upstream is fixed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/unit/test_resolver.py')
| -rw-r--r-- | tests/unit/test_resolver.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_resolver.py b/tests/unit/test_resolver.py index 8c93a84..d9a1dcd 100644 --- a/tests/unit/test_resolver.py +++ b/tests/unit/test_resolver.py @@ -84,3 +84,14 @@ class TestResolverBudget(unittest.TestCase): self.assertEqual(got["name"], "Fun") # Must hit the show endpoint, not list. client.request.assert_called_with("GET", "/api/v1/budgets/7") + +class TestPiggyResolver(unittest.TestCase): + def test_piggy_by_name(self): + c = client_returning([{"id": "1", "attrs": {"name": "BBVA risparmi"}}]) + self.assertEqual(Resolver(c).piggy("bbva risparmi")["id"], "1") + + def test_piggy_by_id_hits_show_endpoint(self): + c = MagicMock() + c.request.return_value = {"data": {"id": "1", "attributes": {"name": "X"}}} + Resolver(c).piggy("1") + self.assertEqual(c.request.call_args[0][1], "/api/v1/piggy-banks/1") |
