diff --git a/src/open_inwoner/cms/products/tests/test_plugin_categories.py b/src/open_inwoner/cms/products/tests/test_plugin_categories.py index 8aeb96444b..018fd2beda 100644 --- a/src/open_inwoner/cms/products/tests/test_plugin_categories.py +++ b/src/open_inwoner/cms/products/tests/test_plugin_categories.py @@ -7,7 +7,7 @@ import requests_mock from cms.apphook_pool import apphook_pool from dateutil.relativedelta import relativedelta -from django_webtest import WebTest +from django_webtest import TransactionWebTest, WebTest from furl import furl from requests import RequestException from zgw_consumers.api_models.constants import VertrouwelijkheidsAanduidingen @@ -322,7 +322,7 @@ def test_only_published_categories_exist_in_home_page_when_logged_in_with_eherke @override_settings(ROOT_URLCONF="open_inwoner.cms.tests.urls") -class TestCategoriesCaseFiltering(ClearCachesMixin, WebTest): +class TestCategoriesCaseFiltering(ClearCachesMixin, TransactionWebTest): def setUp(self): super().setUp() diff --git a/src/open_inwoner/pdc/managers.py b/src/open_inwoner/pdc/managers.py index 26dab6c8e5..f060845752 100644 --- a/src/open_inwoner/pdc/managers.py +++ b/src/open_inwoner/pdc/managers.py @@ -9,7 +9,7 @@ from open_inwoner.accounts.models import User from open_inwoner.configurations.models import SiteConfiguration from open_inwoner.openzaak.api_models import Zaak -from open_inwoner.openzaak.clients import build_zaken_client +from open_inwoner.openzaak.clients import MultiZgwClientProxy, build_zaken_clients from open_inwoner.openzaak.models import ZaakTypeConfig from open_inwoner.openzaak.utils import get_user_fetch_parameters @@ -54,11 +54,13 @@ def filter_by_zaken_for_request(self, request): if not request.user.bsn and not request.user.kvk: return self - client = build_zaken_client() - if client is None: - return self.none() + clients = build_zaken_clients() + proxy_result = MultiZgwClientProxy(clients) + proxy_result = proxy_result.fetch_cases(**get_user_fetch_parameters(request)) + if proxy_result.has_errors: + self.log_system_action("unable to retrieve cases", user=request.user) - cases = client.fetch_cases(**get_user_fetch_parameters(request)) + cases = proxy_result.join_results() return self.filter_by_zaken(cases)