Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
adde8ac0
Commit
adde8ac0
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-2737 UserManager url in Konstante ausgelagert
parent
b0434f8a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java
+6
-3
6 additions, 3 deletions
...rver/src/test/java/de/itvsh/goofy/RootControllerTest.java
with
6 additions
and
3 deletions
goofy-server/src/test/java/de/itvsh/goofy/RootControllerTest.java
+
6
−
3
View file @
adde8ac0
...
@@ -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
());
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment