forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ufal/be-user-registration-missing (#463)
* The user registration is added when the eperson is created by the ui. * try using newer checkout, same as upstream, since error is with git --------- Co-authored-by: MajoBerger <[email protected]>
- Loading branch information
1 parent
7d1fdb8
commit 29880ed
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ | |
import org.dspace.app.rest.model.patch.ReplaceOperation; | ||
import org.dspace.app.rest.test.AbstractControllerIntegrationTest; | ||
import org.dspace.app.rest.test.MetadataPatchSuite; | ||
import org.dspace.builder.ClarinUserRegistrationBuilder; | ||
import org.dspace.builder.CollectionBuilder; | ||
import org.dspace.builder.CommunityBuilder; | ||
import org.dspace.builder.EPersonBuilder; | ||
|
@@ -120,6 +121,8 @@ public void createTest() throws Exception { | |
|
||
AtomicReference<UUID> idRef = new AtomicReference<UUID>(); | ||
AtomicReference<UUID> idRefNoEmbeds = new AtomicReference<UUID>(); | ||
AtomicReference<Integer> idRefUserDataReg = new AtomicReference<Integer>(); | ||
AtomicReference<Integer> idRefUserDataFullReg = new AtomicReference<Integer>(); | ||
|
||
String authToken = getAuthToken(admin.getEmail(), password); | ||
|
||
|
@@ -155,11 +158,51 @@ public void createTest() throws Exception { | |
.andExpect(content().contentType(contentType)) | ||
.andExpect(jsonPath("$", HalMatcher.matchNoEmbeds())) | ||
.andDo(result -> idRefNoEmbeds | ||
.set(UUID.fromString(read(result.getResponse().getContentAsString(), "$.id"))));; | ||
.set(UUID.fromString(read(result.getResponse().getContentAsString(), "$.id")))); | ||
|
||
// Check that the user registration for test data user has been created | ||
getClient(authToken).perform(get("/api/core/clarinuserregistration/search/byEPerson") | ||
.param("userUUID", String.valueOf(idRef.get())) | ||
.contentType(contentType)) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.page.totalElements", is(1))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].id", is(not(empty())))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].email", is("[email protected]"))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].confirmation", is(true))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].ePersonID", is(idRef.get().toString()))) | ||
.andDo(result -> idRefUserDataReg | ||
.set(read(result.getResponse().getContentAsString(), | ||
"$._embedded.clarinuserregistrations[0].id"))); | ||
|
||
// Check that the user registration for test data full user has been created | ||
getClient(authToken).perform(get("/api/core/clarinuserregistration/search/byEPerson") | ||
.param("userUUID", String.valueOf(idRefNoEmbeds.get())) | ||
.contentType(contentType)) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$.page.totalElements", is(1))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].id", is(not(empty())))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].email", | ||
is("[email protected]"))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].confirmation", is(true))) | ||
.andExpect(jsonPath( | ||
"$._embedded.clarinuserregistrations[0].ePersonID", | ||
is(idRefNoEmbeds.get().toString()))) | ||
.andDo(result -> idRefUserDataFullReg | ||
.set(read(result.getResponse().getContentAsString(), | ||
"$._embedded.clarinuserregistrations[0].id"))); | ||
|
||
} finally { | ||
EPersonBuilder.deleteEPerson(idRef.get()); | ||
EPersonBuilder.deleteEPerson(idRefNoEmbeds.get()); | ||
ClarinUserRegistrationBuilder.deleteClarinUserRegistration(idRefUserDataReg.get()); | ||
ClarinUserRegistrationBuilder.deleteClarinUserRegistration(idRefUserDataFullReg.get()); | ||
} | ||
} | ||
|
||
|