-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#2566] Persist originating service on zgw clients
To support multiple zgw backends, we frequently need to determine which backend to query for which resource. As a first step to keeping better track of where ZGW objects come from, in this commit we persist the zgw service used to configure a client on the client object, so that we can later fetch and persist this service to facilitate easier target backend resolution.
- Loading branch information
1 parent
fefe559
commit dd3f053
Showing
2 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.test import TestCase | ||
|
||
from zgw_consumers.constants import APITypes | ||
from zgw_consumers.models import Service | ||
|
||
from open_inwoner.openzaak.clients import ( | ||
build_catalogi_client, | ||
build_documenten_client, | ||
build_forms_client, | ||
build_zaken_client, | ||
) | ||
from open_inwoner.openzaak.tests.factories import ZGWApiGroupConfigFactory | ||
|
||
|
||
class ClientFactoryTestCase(TestCase): | ||
def setUp(self): | ||
ZGWApiGroupConfigFactory() | ||
|
||
def test_originating_service_is_persisted_on_client(self): | ||
for factory, api_type in ( | ||
(build_forms_client, APITypes.orc), | ||
(build_zaken_client, APITypes.zrc), | ||
(build_documenten_client, APITypes.drc), | ||
(build_catalogi_client, APITypes.ztc), | ||
): | ||
client = factory() | ||
self.assertIsInstance(client.configured_from, Service) | ||
self.assertEqual(client.configured_from.api_type, api_type) |