mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
DS-4006: Added explicit check for "groups" link in Group Rest object
This commit is contained in:
@@ -28,7 +28,6 @@ public class GroupRest extends DSpaceObjectRest {
|
|||||||
|
|
||||||
private boolean permanent;
|
private boolean permanent;
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
private List<GroupRest> groups;
|
private List<GroupRest> groups;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -57,6 +56,7 @@ public class GroupRest extends DSpaceObjectRest {
|
|||||||
this.permanent = permanent;
|
this.permanent = permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
@LinkRest(linkClass = GroupRest.class)
|
@LinkRest(linkClass = GroupRest.class)
|
||||||
public List<GroupRest> getGroups() {
|
public List<GroupRest> getGroups() {
|
||||||
return groups;
|
return groups;
|
||||||
|
@@ -10,6 +10,7 @@ package org.dspace.app.rest.matcher;
|
|||||||
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
|
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.hamcrest.Matchers.endsWith;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -25,16 +26,18 @@ public class GroupMatcher {
|
|||||||
hasJsonPath("$.uuid", is(uuid.toString())),
|
hasJsonPath("$.uuid", is(uuid.toString())),
|
||||||
hasJsonPath("$.name", is(name)),
|
hasJsonPath("$.name", is(name)),
|
||||||
hasJsonPath("$.type", is("group")),
|
hasJsonPath("$.type", is("group")),
|
||||||
hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/" + uuid.toString()))
|
hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/" + uuid.toString())),
|
||||||
|
hasJsonPath("$._links.groups.href", endsWith(uuid.toString() + "/groups"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Matcher<? super Object> matchGroupWithName(String name) {
|
public static Matcher<? super Object> matchGroupWithName(String name) {
|
||||||
return allOf(
|
return allOf(
|
||||||
hasJsonPath("$.name", is(name)),
|
hasJsonPath("$.name", is(name)),
|
||||||
hasJsonPath("$.type", is("group"))
|
hasJsonPath("$.type", is("group")),
|
||||||
|
hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/")),
|
||||||
|
hasJsonPath("$._links.groups.href", endsWith("/groups"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user