From 72f73de2dd0114ed11662354b5fcd0a9886ea64b Mon Sep 17 00:00:00 2001 From: Mustafa Baser Date: Wed, 28 Dec 2022 11:06:14 +0300 Subject: [PATCH] fix: jans-linux-setup load test data with jans-auth only --- .../jans_setup/setup_app/test_data_loader.py | 22 ++++++++++++++++++- .../server/config-oxauth-test-data.properties | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/jans-linux-setup/jans_setup/setup_app/test_data_loader.py b/jans-linux-setup/jans_setup/setup_app/test_data_loader.py index c14028f33d4..959cc703e13 100644 --- a/jans-linux-setup/jans_setup/setup_app/test_data_loader.py +++ b/jans-linux-setup/jans_setup/setup_app/test_data_loader.py @@ -17,7 +17,7 @@ from setup_app.utils.ldif_utils import myLdifParser, schema2json from setup_app.pylib.schema import ObjectClass from setup_app.pylib.ldif4.ldif import LDIFWriter - +from setup_app.pylib.jproperties import Properties class TestDataLoader(BaseInstaller, SetupUtils): @@ -215,6 +215,26 @@ def load_test_data(self): self.render_templates_folder(self.template_base, ignoredirs=ignoredirs) + if Config.get('jca_client_id') or Config.get('jca_test_client_id'): + config_oxauth_test_data_server_properties_fn = os.path.join(Config.output_dir, 'test/jans-auth/server/config-oxauth-test-data.properties') + config_oxauth_test_data_server_properties = Properties() + + with open(config_oxauth_test_data_server_properties_fn, 'rb') as f: + config_oxauth_test_data_server_properties.load(f, 'utf-8') + + keep_clients = config_oxauth_test_data_server_properties["test.keep.clients"].data.split(',') + keep_clients = [client_id.strip() for client_id in keep_clients] + + if Config.get('jca_client_id'): + keep_clients.append(Config.jca_client_id) + if Config.get('jca_test_client_id'): + keep_clients.append(Config.jca_test_client_id) + + config_oxauth_test_data_server_properties["test.keep.clients"] = ', '.join(keep_clients) + + with open(config_oxauth_test_data_server_properties_fn, 'wb') as w: + config_oxauth_test_data_server_properties.store(w) + self.logIt("Loading test ldif files") Config.pbar.progress(self.service_name, "Importing ldif files", False) diff --git a/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-oxauth-test-data.properties b/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-oxauth-test-data.properties index e94177255ba..51cdc171999 100644 --- a/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-oxauth-test-data.properties +++ b/jans-linux-setup/jans_setup/templates/test/jans-auth/server/config-oxauth-test-data.properties @@ -27,7 +27,7 @@ sector.identifier.id.bad=840ef58d-a7d0-4986-af7b-71ed0089ce61 contact.email.1=mike@jans.org contact.email.2=javier@jans.org -test.keep.clients=%(scim_client_id)s, %(jca_client_id)s, AB77-1A2B, 3E20, FF81-2D39, %(jca_test_client_id)s +test.keep.clients=%(scim_client_id)s, AB77-1A2B, 3E20, FF81-2D39 clientKeyStoreFile=profiles/%(hostname)s/client_keystore.p12 clientKeyStoreSecret=secret