Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
817ca5cc
Commit
817ca5cc
authored
7 years ago
by
felmer
Browse files
Options
Downloads
Patches
Plain Diff
SSDM-5721: Improve SearchPersonTest.
SVN: 38962
parent
ce0f33be
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchPersonTest.java
+18
-2
18 additions, 2 deletions
...thz/sis/openbis/systemtest/asapi/v3/SearchPersonTest.java
with
18 additions
and
2 deletions
openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchPersonTest.java
+
18
−
2
View file @
817ca5cc
...
...
@@ -43,19 +43,26 @@ public class SearchPersonTest extends AbstractTest
// Given
String
sessionToken
=
v3api
.
login
(
TEST_USER
,
PASSWORD
);
PersonSearchCriteria
searchCriteria
=
new
PersonSearchCriteria
();
searchCriteria
.
withOrOperator
();
searchCriteria
.
withUserId
().
thatStartsWith
(
"observer"
);
searchCriteria
.
withUserId
().
thatContains
(
"role"
);
searchCriteria
.
withLastName
().
thatContains
(
"active"
);
PersonFetchOptions
fetchOptions
=
new
PersonFetchOptions
();
fetchOptions
.
withSpace
();
fetchOptions
.
withRoleAssignments
().
withSpace
();
fetchOptions
.
withRegistrator
();
// Then
List
<
Person
>
persons
=
v3api
.
searchPersons
(
sessionToken
,
searchCriteria
,
fetchOptions
).
getObjects
();
// When
assertEquals
(
render
(
persons
),
"observer: John Observer observer@o.o, home space:CISD, "
assertEquals
(
render
(
persons
),
"[inactive] inactive: John Inactive inactive@in.active, home space:CISD, []\n"
+
"observer: John Observer observer@o.o, home space:CISD, "
+
"[SPACE_OBSERVER Space TESTGROUP]\n"
+
"observer_cisd: John ObserverCISD observer_cisd@o.o, home space:CISD, "
+
"[SPACE_ADMIN Space TESTGROUP, SPACE_OBSERVER Space CISD]\n"
);
+
"[SPACE_ADMIN Space TESTGROUP, SPACE_OBSERVER Space CISD]\n"
+
"test_role: John 3 Doe test role test_role@in.active, home space:CISD, "
+
"[SPACE_POWER_USER Space CISD], registrator: test\n"
);
}
private
String
render
(
List
<
Person
>
persons
)
...
...
@@ -77,6 +84,10 @@ public class SearchPersonTest extends AbstractTest
private
String
render
(
Person
person
)
{
StringBuilder
builder
=
new
StringBuilder
();
if
(
person
.
isActive
()
==
false
)
{
builder
.
append
(
"[inactive] "
);
}
builder
.
append
(
person
.
getUserId
()).
append
(
":"
);
appendTo
(
builder
,
person
.
getFirstName
());
appendTo
(
builder
,
person
.
getLastName
());
...
...
@@ -89,6 +100,11 @@ public class SearchPersonTest extends AbstractTest
List
<
RoleAssignment
>
roleAssignments
=
person
.
getRoleAssignments
();
String
string
=
renderAssignments
(
roleAssignments
);
builder
.
append
(
", "
).
append
(
string
);
Person
registrator
=
person
.
getRegistrator
();
if
(
registrator
!=
null
)
{
builder
.
append
(
", registrator: "
).
append
(
registrator
.
getUserId
());
}
return
builder
.
toString
();
}
...
...
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