From f3f01f2617e6f47f991394a54d8189d1f4556d85 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Mon, 8 Jan 2024 14:18:42 +0100 Subject: [PATCH] OZG-4653 OZG-4708 extract function --- alfa-client/apps/alfa-e2e/Jenkinsfile | 14 +++++++++----- alfa-client/apps/alfa-e2e/Jenkinsfile-static | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/alfa-client/apps/alfa-e2e/Jenkinsfile b/alfa-client/apps/alfa-e2e/Jenkinsfile index 3e2c42250d..28d6da6d16 100644 --- a/alfa-client/apps/alfa-e2e/Jenkinsfile +++ b/alfa-client/apps/alfa-e2e/Jenkinsfile @@ -740,14 +740,18 @@ Map readUsersFixtures(String fixturesPath, String userFolder) { return usersFixturesFiles.split("\\n") .collect { userFixtureFile -> def userFixture = readJSON file: "${fixturesPath}/${userFolder}/${userFixtureFile}" - return ["name" : userFixture.name, - "password" : userFixture.password, - "first_name": userFixture.get("firstName", ""), - "last_name" : userFixture.get("lastName", ""), - "email" : userFixture.get("email", "")] + return createUserFromFixture(userFixture) }.collectEntries { [it.name, it] } } +Map createUserFromFixture(Map userFixture) { + return ["name" : userFixture.name, + "password" : userFixture.password, + "first_name": userFixture.get("firstName", ""), + "last_name" : userFixture.get("lastName", ""), + "email" : userFixture.get("email", "")] +} + String getKeycloakAccessToken(String realm) { def userManagerApiUserCredentials = getUserManagerApiUserCredentials(realm) diff --git a/alfa-client/apps/alfa-e2e/Jenkinsfile-static b/alfa-client/apps/alfa-e2e/Jenkinsfile-static index 3182e1110f..cc5617a580 100644 --- a/alfa-client/apps/alfa-e2e/Jenkinsfile-static +++ b/alfa-client/apps/alfa-e2e/Jenkinsfile-static @@ -452,14 +452,18 @@ Map readUsersFixtures(String fixturesPath, String userFolder) { return usersFixturesFiles.split("\\n") .collect { userFixtureFile -> def userFixture = readJSON file: "${fixturesPath}/${userFolder}/${userFixtureFile}" - return ["name" : userFixture.name, - "password" : userFixture.password, - "first_name": userFixture.get("firstName", ""), - "last_name" : userFixture.get("lastName", ""), - "email" : userFixture.get("email", "")] + return createUserFromFixture(userFixture) }.collectEntries { [it.name, it] } } +Map createUserFromFixture(Map userFixture) { + return ["name" : userFixture.name, + "password" : userFixture.password, + "first_name": userFixture.get("firstName", ""), + "last_name" : userFixture.get("lastName", ""), + "email" : userFixture.get("email", "")] +} + String getKeycloakAccessToken(String realm) { def userManagerApiUserCredentials = getUserManagerApiUserCredentials(realm) -- GitLab