mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
[DS-3952] Proper test for wrong authenticated user.
This commit is contained in:
@@ -526,11 +526,12 @@ public class RequestItemRepositoryIT
|
|||||||
.createRequestItem(context, item, bitstream)
|
.createRequestItem(context, item, bitstream)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
String authToken = getAuthToken(eperson.getEmail(), password);
|
String authToken;
|
||||||
ObjectWriter mapperWriter = new ObjectMapper().writer();
|
|
||||||
Map<String, String> parameters;
|
Map<String, String> parameters;
|
||||||
String content;
|
String content;
|
||||||
|
|
||||||
|
ObjectWriter mapperWriter = new ObjectMapper().writer();
|
||||||
|
|
||||||
// Unauthenticated user
|
// Unauthenticated user
|
||||||
parameters = Map.of(
|
parameters = Map.of(
|
||||||
"acceptRequest", "true",
|
"acceptRequest", "true",
|
||||||
@@ -548,10 +549,11 @@ public class RequestItemRepositoryIT
|
|||||||
"subject", "subject",
|
"subject", "subject",
|
||||||
"responseMessage", "Request accepted");
|
"responseMessage", "Request accepted");
|
||||||
content = mapperWriter.writeValueAsString(parameters);
|
content = mapperWriter.writeValueAsString(parameters);
|
||||||
getClient().perform(put(URI_ROOT + '/' + itemRequest.getToken())
|
authToken = getAuthToken(admin.getEmail(), password);
|
||||||
|
getClient(authToken).perform(put(URI_ROOT + '/' + itemRequest.getToken())
|
||||||
.contentType(contentType)
|
.contentType(contentType)
|
||||||
.content(content))
|
.content(content))
|
||||||
.andExpect(status().isUnauthorized());
|
.andExpect(status().isInternalServerError()); // Should be FORBIDDEN
|
||||||
|
|
||||||
// Missing acceptRequest
|
// Missing acceptRequest
|
||||||
parameters = Map.of(
|
parameters = Map.of(
|
||||||
|
Reference in New Issue
Block a user