Closed lasuk closed 5 months ago
Problem
The mirror_accounts method fails for accounts assigned to a top-level group/category such as '/Assets'.
mirror_accounts
import pandas as pd from cashctrl_ledger import CashCtrlLedger account = pd.DataFrame({ 'account': ['1021', '1022', '1023'], 'currency': ['CHF', 'EUR', 'USD'], 'text': ['Credit Suisse - CHF', 'Credit Suisse - EUR', 'Credit Suisse - USD'], 'group': ['/Assets/Anlagevermögen', '/Assets', '/Assets'], }) cc_ledger = CashCtrlLedger() # This works cc_ledger.mirror_account_chart(account.iloc[[0]].copy(), delete=False) # This fails cc_ledger.mirror_account_chart(account.iloc[[1]].copy(), delete=False) # Traceback (most recent call last): # File "<stdin>", line 1, in <module> # File "/Users/lukas/macx/cashctrl_ledger/cashctrl_ledger/ledger.py", line 164, in mirror_account_chart # self.update_account( # File "/Users/lukas/macx/cashctrl_ledger/cashctrl_ledger/ledger.py", line 210, in update_account # "categoryId": self._client.account_category_to_id(group), # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # File "/Users/lukas/macx/cashctrl_api/cashctrl_api/cashed_client.py", line 297, in account_category_to_id # raise ValueError(f"No id found for account category path: {path}") # ValueError: No id found for account category path: /Assets
Tasks
Problem
The
mirror_accounts
method fails for accounts assigned to a top-level group/category such as '/Assets'.Tasks
mirror_accounts
to include accounts at a top level category. Show that this test fails with the current implementation.