use of org.eclipse.openvsx.json.NamespaceMembershipJson in project openvsx by eclipse.
the class AdminAPITest method testGetNamespaceMembers.
@Test
public void testGetNamespaceMembers() throws Exception {
mockAdminUser();
var namespace = mockNamespace();
var user = new UserData();
user.setLoginName("other_user");
var membership1 = new NamespaceMembership();
membership1.setNamespace(namespace);
membership1.setUser(user);
membership1.setRole(NamespaceMembership.ROLE_OWNER);
Mockito.when(repositories.findMemberships(namespace)).thenReturn(Streamable.of(membership1));
mockMvc.perform(get("/admin/namespace/{namespace}/members", "foobar").with(user("admin_user").authorities(new SimpleGrantedAuthority(("ROLE_ADMIN")))).with(csrf().asHeader())).andExpect(status().isOk()).andExpect(content().json(namespaceMemberJson(nml -> {
var m = new NamespaceMembershipJson();
m.namespace = "foobar";
m.user = new UserJson();
m.user.loginName = "other_user";
m.role = "owner";
nml.namespaceMemberships = Arrays.asList(m);
})));
}
Aggregations