Skip to content
Snippets Groups Projects
Commit adde8ac0 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-2737 UserManager url in Konstante ausgelagert

parent b0434f8a
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,8 @@ import de.itvsh.goofy.system.SystemStatusService; ...@@ -35,6 +35,8 @@ import de.itvsh.goofy.system.SystemStatusService;
class RootControllerTest { class RootControllerTest {
private static final String SEARCH_BY = "/test?searchBy={searchBy}"; 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 static final String USERMANAGER_URL = "http://localhost:8080";
private final String PATH = "/api"; private final String PATH = "/api";
...@@ -231,13 +233,13 @@ class RootControllerTest { ...@@ -231,13 +233,13 @@ class RootControllerTest {
class UsermanagerUrlConfigured { class UsermanagerUrlConfigured {
@Test @Test
void shouldHaveCurrentUserLink() { 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); when(currentUserService.getUserId()).thenReturn(GoofyUserTestFactory.ID);
var model = controller.getRootResource(); var model = controller.getRootResource();
assertThat(model.getLink(RootController.REL_CURRENT_USER)).isPresent().get().extracting(Link::getHref) 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()); .getHref());
} }
} }
...@@ -257,10 +259,11 @@ class RootControllerTest { ...@@ -257,10 +259,11 @@ class RootControllerTest {
@DisplayName("when external Id cannot resolved to internal id") @DisplayName("when external Id cannot resolved to internal id")
@Nested @Nested
class NoInternalUserId { class NoInternalUserId {
@BeforeEach @BeforeEach
void init() { void init() {
doReturn(true).when(controller).hasVerwaltungRole(); 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()); when(internalUserIdService.getUserId(any())).thenReturn(Optional.empty());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment