-
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.
[#2966] Refactor configuration for registering contactmomenten
- move relevant fields from ESuiteKlantConfig to global KlantenSysteemConfig so they can be used for OpenKlant2 as well
- Loading branch information
Paul Schilling
committed
Jan 15, 2025
1 parent
cdc794a
commit 0fb6313
Showing
11 changed files
with
291 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,8 @@ | |
DigidUserFactory, | ||
eHerkenningUserFactory, | ||
) | ||
from open_inwoner.openklant.constants import Status | ||
from open_inwoner.openklant.models import ESuiteKlantConfig | ||
from open_inwoner.openklant.constants import KlantenServiceType, Status | ||
from open_inwoner.openklant.models import ESuiteKlantConfig, KlantenSysteemConfig | ||
from open_inwoner.openklant.services import eSuiteVragenService | ||
from open_inwoner.openklant.tests.data import CONTACTMOMENTEN_ROOT, KLANTEN_ROOT | ||
from open_inwoner.openzaak.models import CatalogusConfig, OpenZaakConfig | ||
|
@@ -82,21 +82,25 @@ def setUp(self): | |
) | ||
self.oz_config.save() | ||
|
||
# klant config | ||
self.klant_config = ESuiteKlantConfig.get_solo() | ||
# klant configurations | ||
self.klant_config = KlantenSysteemConfig.get_solo() | ||
self.klant_config.primary_backend = KlantenServiceType.ESUITE.value | ||
self.klant_config.register_contact_via_api = True | ||
self.klant_config.send_email_confirmation = True | ||
self.klant_config.register_contact_moment = True | ||
self.klant_config.register_bronorganisatie_rsin = "123456788" | ||
self.klant_config.register_type = "Melding" | ||
self.klant_config.register_employee_id = "FooVonBar" | ||
self.klant_config.register_channel = "the-designated-channel" | ||
self.klant_config.klanten_service = ServiceFactory( | ||
self.klant_config.save() | ||
|
||
self.esuite_config = ESuiteKlantConfig.get_solo() | ||
self.esuite_config.register_bronorganisatie_rsin = "123456788" | ||
self.esuite_config.register_type = "Melding" | ||
self.esuite_config.register_employee_id = "FooVonBar" | ||
self.esuite_config.register_channel = "the-designated-channel" | ||
self.esuite_config.klanten_service = ServiceFactory( | ||
api_root=KLANTEN_ROOT, api_type=APITypes.kc | ||
) | ||
self.klant_config.contactmomenten_service = ServiceFactory( | ||
self.esuite_config.contactmomenten_service = ServiceFactory( | ||
api_root=CONTACTMOMENTEN_ROOT, api_type=APITypes.cmc | ||
) | ||
self.klant_config.save() | ||
self.esuite_config.save() | ||
|
||
self.zaak = generate_oas_component_cached( | ||
"zrc", | ||
|
@@ -371,7 +375,7 @@ def test_form_is_shown_if_open_klant_api_configured( | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
self.assertTrue(self.klant_config.has_api_configuration()) | ||
self.assertTrue(self.klant_config.has_api_configuration) | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
contact_form = response.pyquery("#contact-form") | ||
|
@@ -387,12 +391,14 @@ def test_form_is_shown_if_open_klant_email_configured( | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
self.klant_config.register_email = "[email protected]" | ||
self.klant_config.register_contact_moment = False | ||
self.esuite_config.klanten_service = None | ||
self.esuite_config.save() | ||
|
||
self.klant_config.register_contact_email = "[email protected]" | ||
self.klant_config.save() | ||
|
||
self.assertFalse(self.klant_config.has_api_configuration()) | ||
self.assertTrue(self.klant_config.has_register()) | ||
self.assertFalse(self.klant_config.has_api_configuration) | ||
self.assertTrue(self.klant_config.contact_registration_enabled) | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
contact_form = response.pyquery("#contact-form") | ||
|
@@ -411,8 +417,8 @@ def test_form_is_shown_if_open_klant_email_and_api_configured( | |
self.klant_config.register_email = "[email protected]" | ||
self.klant_config.save() | ||
|
||
self.assertTrue(self.klant_config.has_api_configuration()) | ||
self.assertTrue(self.klant_config.has_register()) | ||
self.assertTrue(self.klant_config.has_api_configuration) | ||
self.assertTrue(self.klant_config.contact_registration_enabled) | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
contact_form = response.pyquery("#contact-form") | ||
|
@@ -428,15 +434,14 @@ def test_no_form_shown_if_open_klant_not_configured( | |
self._setUpMocks(m) | ||
|
||
# reset | ||
self.klant_config.klanten_service = None | ||
self.klant_config.contactmomenten_service = None | ||
self.klant_config.register_email = "" | ||
self.klant_config.register_contact_moment = False | ||
self.klant_config.register_bronorganisatie_rsin = "" | ||
self.klant_config.register_type = "" | ||
self.klant_config.register_employee_id = "" | ||
self.klant_config.save() | ||
self.assertFalse(self.klant_config.has_api_configuration()) | ||
self.esuite_config.klanten_service = None | ||
self.esuite_config.contactmomenten_service = None | ||
self.esuite_config.register_bronorganisatie_rsin = "" | ||
self.esuite_config.register_type = "" | ||
self.esuite_config.register_employee_id = "" | ||
self.esuite_config.save() | ||
|
||
self.assertFalse(self.klant_config.has_api_configuration) | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
contact_form = response.pyquery("#contact-form") | ||
|
@@ -665,8 +670,8 @@ def test_form_success_with_email(self, m, mock_contactmoment, mock_send_confirm) | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
self.klant_config.register_email = "[email protected]" | ||
self.klant_config.register_contact_moment = False | ||
self.klant_config.register_contact_email = "[email protected]" | ||
self.klant_config.register_contact_via_api = False | ||
self.klant_config.save() | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
|
@@ -708,7 +713,7 @@ def test_form_success_with_both_email_and_api( | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
self.klant_config.register_email = "[email protected]" | ||
self.klant_config.register_contact_email = "[email protected]" | ||
self.klant_config.save() | ||
|
||
response = self.app.get(self.case_detail_url, user=self.user) | ||
|
@@ -746,7 +751,7 @@ def test_send_email_confirmation_is_configurable__send_enabled( | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
config = ESuiteKlantConfig.get_solo() | ||
config = KlantenSysteemConfig.get_solo() | ||
config.send_email_confirmation = True | ||
config.save() | ||
|
||
|
@@ -766,7 +771,7 @@ def test_send_email_confirmation_is_configurable__send_disabled( | |
self._setUpMocks(m) | ||
self._setUpExtraMocks(m) | ||
|
||
config = ESuiteKlantConfig.get_solo() | ||
config = KlantenSysteemConfig.get_solo() | ||
config.send_email_confirmation = False | ||
config.save() | ||
|
||
|
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
7 changes: 2 additions & 5 deletions
7
src/open_inwoner/configurations/tests/bootstrap/files/esuiteklant_config_step_full.yaml
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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
openklant_config_enable: true | ||
openklant_config: | ||
esuiteklant_config_enable: true | ||
esuiteklant_config: | ||
klanten_service_identifier: klanten-service | ||
contactmomenten_service_identifier: contactmomenten-service | ||
exclude_contactmoment_kanalen: [] | ||
register_email: [email protected] | ||
register_contact_moment: true | ||
register_bronorganisatie_rsin: '837194569' | ||
register_channel: email | ||
register_type: bericht | ||
register_employee_id: '1234' | ||
use_rsin_for_innNnpId_query_parameter: true | ||
send_email_confirmation: false |
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 |
---|---|---|
|
@@ -43,8 +43,6 @@ def test_configure(self): | |
self.assertEqual(config.klanten_service, kc) | ||
self.assertEqual(config.contactmomenten_service, cmc) | ||
|
||
self.assertEqual(config.register_email, "[email protected]") | ||
self.assertEqual(config.register_contact_moment, True) | ||
self.assertEqual(config.register_bronorganisatie_rsin, "837194569") | ||
self.assertEqual(config.register_channel, "email") | ||
self.assertEqual(config.register_type, "bericht") | ||
|
@@ -149,8 +147,8 @@ def assert_values(): | |
self.assertEqual(config.klanten_service, kc) | ||
self.assertEqual(config.contactmomenten_service, cmc) | ||
|
||
self.assertEqual(config.register_email, "[email protected]") | ||
self.assertEqual(config.register_contact_moment, True) | ||
# self.assertEqual(config.register_email, "[email protected]") | ||
# self.assertEqual(config.register_contact_moment, True) | ||
self.assertEqual(config.register_bronorganisatie_rsin, "837194569") | ||
self.assertEqual(config.register_channel, "email") | ||
self.assertEqual(config.register_type, "bericht") | ||
|
@@ -164,8 +162,8 @@ def assert_values(): | |
assert_values() | ||
|
||
config = ESuiteKlantConfig.get_solo() | ||
config.register_email = "[email protected]" | ||
config.register_contact_moment = False | ||
# config.register_email = "[email protected]" | ||
# config.register_contact_moment = False | ||
config.register_bronorganisatie_rsin = "800000009" | ||
config.register_channel = "not-email" | ||
config.register_type = "not-bericht" | ||
|
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
Oops, something went wrong.