Repository: bvanelli/actualpy
Pull request #130 (2025-06-05 19:53:55)

feat: Add tests for 25.6.1
Also fixes the new namings for the budget types.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/bvanelli/actualpy/pull/130?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 97.94%. Comparing base [(`668b932`)](https://app.codecov.io/gh/bvanelli/actualpy/commit/668b932b19a92c54a4768588a2107d242e58c720?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli) to head [(`bfc63a1`)](https://app.codecov.io/gh/bvanelli/actualpy/commit/bfc63a1806e5d7faafd4a41cf854be2e8b7c06f9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #130   +/-   ##
=======================================
  Coverage   97.94%   97.94%           
=======================================
  Files          18       18           
  Lines        2432     2432           
=======================================
  Hits         2382     2382           
  Misses         50       50           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/bvanelli/actualpy/pull/130?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brunno+Vanelli).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>

Patch:
diff --git a/actual/queries.py b/actual/queries.py
index 64da1d5..0e74c8f 100644
--- a/actual/queries.py
+++ b/actual/queries.py
@@ -656,16 +656,16 @@ def _get_budget_table(s: Session) -> typing.Type[typing.Union[ReflectBudgets, Ze
     """
     Finds out which type of budget the user uses. The types are:
 
-    - Envelope budgeting (default, recommended): `budgetType` is `rollover`, table is ZeroBudgets
-    - Tracking budgeting: `budgetType` is `report`, table is `ReflectBudgets`
+    - Envelope budgeting (default, recommended): `budgetType` is `rollover` or `envelope`, table is ZeroBudgets
+    - Tracking budgeting: `budgetType` is `report` or `tracking`, table is `ReflectBudgets`
 
     :param s: session from Actual local database.
     :return: table object for the budget type, based on the preferences.
     """
     budget_type = get_preference(s, "budgetType")
-    if budget_type and budget_type.value == "report":
+    if budget_type and budget_type.value in ("report", "tracking"):
         return ReflectBudgets
-    else:  # budgetType is rollover
+    else:  # budgetType is rollover or envelope
         return ZeroBudgets
 
 


Test patch:
diff --git a/tests/test_database.py b/tests/test_database.py
index 0b21243..09b8d01 100644
--- a/tests/test_database.py
+++ b/tests/test_database.py
@@ -200,7 +200,7 @@ def test_rule_insertion_method(session):
 
 @pytest.mark.parametrize(
     "budget_type,budget_table",
-    [("rollover", ZeroBudgets), ("report", ReflectBudgets)],
+    [("rollover", ZeroBudgets), ("report", ReflectBudgets), ("envelope", ZeroBudgets), ("tracking", ReflectBudgets)],
 )
 def test_budgets(session, budget_type, budget_table):
     # set the config
@@ -246,11 +246,11 @@ def test_budgets(session, budget_type, budget_table):
 @pytest.mark.parametrize(
     "budget_type,with_reset,with_previous_value,expected_value_previous_month,expected_value_current_month",
     [
-        ("rollover", False, False, decimal.Decimal(5), decimal.Decimal(25)),
-        ("rollover", False, True, decimal.Decimal(15), decimal.Decimal(35)),
-        ("rollover", True, True, decimal.Decimal(-5), decimal.Decimal(20)),
-        ("rollover", True, False, decimal.Decimal(-15), decimal.Decimal(20)),
-        ("report", False, True, decimal.Decimal(-5), decimal.Decimal(20)),
+        ("envelope", False, False, decimal.Decimal(5), decimal.Decimal(25)),
+        ("envelope", False, True, decimal.Decimal(15), decimal.Decimal(35)),
+        ("envelope", True, True, decimal.Decimal(-5), decimal.Decimal(20)),
+        ("envelope", True, False, decimal.Decimal(-15), decimal.Decimal(20)),
+        ("tracking", False, True, decimal.Decimal(-5), decimal.Decimal(20)),
     ],
 )
 def test_accumulated_budget_amount(
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 5784705..0e9b5d3 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -22,7 +22,7 @@ from actual.queries import (
     get_transactions,
 )
 
-VERSIONS = ["25.4.0"]
+VERSIONS = ["25.4.0", "25.5.0", "25.6.1"]
 
 
 @pytest.fixture(params=VERSIONS)  # todo: support multiple versions at once