diff options
| author | Danilo M. <danix@danix.xyz> | 2026-06-30 15:40:40 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-06-30 15:40:40 +0200 |
| commit | b3d672549dba640c2f4ee978f432857d2ce7ccdf (patch) | |
| tree | 3783dab45eaf18b77a84420297d2445d3ab1742e /tests/unit/test_output.py | |
| parent | d76ab40d673881a0b4a45c9d69930f76a3c989a4 (diff) | |
| download | firefly-cli-b3d672549dba640c2f4ee978f432857d2ce7ccdf.tar.gz firefly-cli-b3d672549dba640c2f4ee978f432857d2ce7ccdf.zip | |
test: cover --human _VIEWS; add TODO.md
Add unit tests for each output view (account, tag, account balance,
category): right columns surfaced, API plumbing dropped. Add TODO.md
listing the deferred command groups and follow-up work.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests/unit/test_output.py')
| -rw-r--r-- | tests/unit/test_output.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/test_output.py b/tests/unit/test_output.py index 5b154d9..2e3e5ea 100644 --- a/tests/unit/test_output.py +++ b/tests/unit/test_output.py @@ -75,3 +75,41 @@ class TestOutput(unittest.TestCase): tty = TTY() emit([tx], human=True, stream=tty) self.assertIn("\033[31m", tty.getvalue()) # tty: withdrawal is red + + def _emit(self, row): + buf = io.StringIO() + emit([row], human=True, stream=buf) + return buf.getvalue() + + def test_view_account_shows_balance_drops_plumbing(self): + # account_role signature -> the account view. + out = self._emit({"id": "6", "name": "BBVA", "type": "asset", + "account_role": "defaultAsset", + "current_balance": "1590.92", "currency_code": "EUR", + "active": True, "iban": "IT68...", "notes": "secret"}) + self.assertIn("BBVA", out) + self.assertIn("1590.92", out) + self.assertIn("currency_code", out) + self.assertNotIn("iban", out) # plumbing column dropped + self.assertNotIn("secret", out) + + def test_view_tag(self): + out = self._emit({"id": "9", "tag": "2026", "description": "yr", + "zoom_level": None, "latitude": None}) + self.assertIn("2026", out) + self.assertIn("description", out) + self.assertNotIn("zoom_level", out) + + def test_view_account_balance(self): + # The balance handler emits id+name+current_balance (no account_role). + out = self._emit({"id": "6", "name": "BBVA", + "current_balance": "1590.92"}) + self.assertIn("current_balance", out) + self.assertIn("1590.92", out) + + def test_view_category_name_only(self): + out = self._emit({"id": "2", "name": "Food", "spent": [], + "primary_currency_code": "EUR", "notes": "junk"}) + self.assertIn("Food", out) + self.assertNotIn("primary_currency_code", out) + self.assertNotIn("spent", out) |
