KEYCLOAK-2785: Admin client should be able to delete a user.

The delete user service should be exposed in the admin client.
This commit is contained in:
Guus der Kinderen 2016-04-08 16:34:46 +02:00
parent def40448ac
commit 38670df49a
No known key found for this signature in database
GPG key ID: C96AB56D670B5AE0
2 changed files with 18 additions and 7 deletions

View file

@ -19,13 +19,7 @@ package org.keycloak.admin.client.resource;
import org.keycloak.representations.idm.UserRepresentation;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@ -59,4 +53,7 @@ public interface UsersResource {
@Path("{id}")
UserResource get(@PathParam("id") String id);
@Path("{id}")
@DELETE
Response delete(@PathParam("id") String id);
}

View file

@ -239,6 +239,20 @@ public class UserTest extends AbstractClientTest {
assertEquals(9, count.intValue());
}
@Test
public void delete() {
Response response = realm.users().delete( createUser() );
assertEquals(204, response.getStatus());
response.close();
}
@Test
public void deleteNonExistent() {
Response response = realm.users().delete( "does-not-exist" );
assertEquals(404, response.getStatus());
response.close();
}
@Test
public void searchPaginated() {
createUsers();