From 05262a7ca02e6a397ba0fc98da6d0ef94cfd127c Mon Sep 17 00:00:00 2001 From: Alex the wizard Date: Tue, 9 Jul 2024 19:37:55 +0300 Subject: [PATCH] fix: call base class method to circumvent the cache --- tests/test_cached_account_categories.py | 7 +++---- tests/test_cached_accounts.py | 7 +++---- tests/test_cached_journal_entries.py | 4 ++-- tests/test_cached_tax_rates.py | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/test_cached_account_categories.py b/tests/test_cached_account_categories.py index b3f2a4f..1b8616f 100644 --- a/tests/test_cached_account_categories.py +++ b/tests/test_cached_account_categories.py @@ -1,7 +1,7 @@ """Unit tests for cached account categories.""" import time -from cashctrl_api import CachedCashCtrlClient +from cashctrl_api import CachedCashCtrlClient, CashCtrlClient import pandas as pd import pytest @@ -12,10 +12,9 @@ def cc_client(): @pytest.fixture(scope="module") -def account_categories(): +def account_categories(cc_client): # Explicitly call the base class method to circumvent the cache. - cc_client = CachedCashCtrlClient() - return cc_client.list_categories("account", include_system=True) + return CashCtrlClient.list_categories(cc_client, "account", include_system=True) def test_account_categories_cache_is_none_on_init(cc_client): diff --git a/tests/test_cached_accounts.py b/tests/test_cached_accounts.py index 0ab3ba7..59558fc 100644 --- a/tests/test_cached_accounts.py +++ b/tests/test_cached_accounts.py @@ -1,7 +1,7 @@ """Unit tests for cached accounts.""" import time -from cashctrl_api import CachedCashCtrlClient +from cashctrl_api import CachedCashCtrlClient, CashCtrlClient import pandas as pd import pytest @@ -12,10 +12,9 @@ def cc_client(): @pytest.fixture(scope="module") -def accounts(): +def accounts(cc_client): # Explicitly call the base class method to circumvent the cache. - cc_client = CachedCashCtrlClient() - return cc_client.list_accounts() + return CashCtrlClient.list_accounts(cc_client) def test_account_cache_is_none_on_init(cc_client): diff --git a/tests/test_cached_journal_entries.py b/tests/test_cached_journal_entries.py index a9fa2c9..3aa7711 100644 --- a/tests/test_cached_journal_entries.py +++ b/tests/test_cached_journal_entries.py @@ -1,7 +1,7 @@ """Unit tests for cached journal entries.""" import time -from cashctrl_api import CachedCashCtrlClient +from cashctrl_api import CachedCashCtrlClient, CashCtrlClient import pandas as pd import pytest @@ -14,7 +14,7 @@ def cc_client() -> CachedCashCtrlClient: @pytest.fixture(scope="module") def journal_entries(cc_client): # Explicitly call the base class method to circumvent the cache. - return cc_client.list_journal_entries() + return CashCtrlClient.list_journal_entries(cc_client) def test_journal_cache_is_none_on_init(cc_client): diff --git a/tests/test_cached_tax_rates.py b/tests/test_cached_tax_rates.py index 4602f57..5021f0c 100644 --- a/tests/test_cached_tax_rates.py +++ b/tests/test_cached_tax_rates.py @@ -1,7 +1,7 @@ """Unit tests for cached tax codes.""" import time -from cashctrl_api import CachedCashCtrlClient +from cashctrl_api import CachedCashCtrlClient, CashCtrlClient import pandas as pd import pytest @@ -14,7 +14,7 @@ def cc_client() -> CachedCashCtrlClient: @pytest.fixture(scope="module") def tax_rates(cc_client): # Explicitly call the base class method to circumvent the cache. - return cc_client.list_tax_rates() + return CashCtrlClient.list_tax_rates(cc_client) def test_tax_rates_cache_is_none_on_init(cc_client):