From adde8ac06bd7b33f0b7d979b41453b0bc1b7886c Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 27 Oct 2022 09:08:47 +0200 Subject: [PATCH] OZG-2737 UserManager url in Konstante ausgelagert --- .../src/test/java/de/itvsh/goofy/RootControllerTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java index 47a5d3f759..04699e4914 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java @@ -35,6 +35,8 @@ import de.itvsh.goofy.system.SystemStatusService; class RootControllerTest { private static final String SEARCH_BY = "/test?searchBy={searchBy}"; + private static final String API_USER_PROFILES_TEMLPATE = "/api/userProfiles/%s"; + private static final String API_USER_PROFILES = "/api/userProfiles/"; private static final String USERMANAGER_URL = "http://localhost:8080"; private final String PATH = "/api"; @@ -231,13 +233,13 @@ class RootControllerTest { class UsermanagerUrlConfigured { @Test void shouldHaveCurrentUserLink() { - when(controller.getUserProfilesUrl()).thenReturn(Optional.of("http://localhost:9092/api/userProfiles/%s")); + when(controller.getUserProfilesUrl()).thenReturn(Optional.of(USERMANAGER_URL + API_USER_PROFILES_TEMLPATE)); when(currentUserService.getUserId()).thenReturn(GoofyUserTestFactory.ID); var model = controller.getRootResource(); assertThat(model.getLink(RootController.REL_CURRENT_USER)).isPresent().get().extracting(Link::getHref) - .isEqualTo(Link.of("http://localhost:9092/api/userProfiles/" + GoofyUserTestFactory.ID, RootController.REL_CURRENT_USER) + .isEqualTo(Link.of(USERMANAGER_URL + API_USER_PROFILES + GoofyUserTestFactory.ID, RootController.REL_CURRENT_USER) .getHref()); } } @@ -257,10 +259,11 @@ class RootControllerTest { @DisplayName("when external Id cannot resolved to internal id") @Nested class NoInternalUserId { + @BeforeEach void init() { doReturn(true).when(controller).hasVerwaltungRole(); - when(controller.getUserProfilesUrl()).thenReturn(Optional.of("http://localhost/api/userProfiles/%s")); + when(controller.getUserProfilesUrl()).thenReturn(Optional.of(USERMANAGER_URL + API_USER_PROFILES)); when(internalUserIdService.getUserId(any())).thenReturn(Optional.empty()); } -- GitLab