Search in sources :

Example 11 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class GroupsResourceTest method notFoundWhenDeletingBadId.

@Test(expected = NotFoundException.class)
public void notFoundWhenDeletingBadId() {
    when(groupDAO.getGroupById(0x1bad1dea)).thenReturn(Optional.empty());
    resource.deleteGroup(user, new LongParam(Long.toString(0x1bad1dea)));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 12 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method missingSecretDisallow.

@Test(expected = NotFoundException.class)
public void missingSecretDisallow() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndRevokeAccess(2, group.getId(), auditLog, "user", new HashMap<>());
    resource.disallowAccess(user, new LongParam("2"), new LongParam(Long.toString(group.getId())));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 13 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method evictThrowsWhenClientIdNotFound.

@Test(expected = NotFoundException.class)
public void evictThrowsWhenClientIdNotFound() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndEvictClient(60984, group.getId(), auditLog, "user", new HashMap<>());
    resource.evictClient(user, new LongParam("60984"), new LongParam(Long.toString(group.getId())));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 14 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method enrollThrowsWhenGroupIdNotFound.

@Test(expected = NotFoundException.class)
public void enrollThrowsWhenGroupIdNotFound() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndEnrollClient(client.getId(), 0xbad, auditLog, "user", new HashMap<>());
    resource.enrollClient(user, new LongParam("44"), new LongParam(Long.toString(0xbad)));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Example 15 with LongParam

use of io.dropwizard.jersey.params.LongParam in project keywhiz by square.

the class MembershipResourceTest method enrollThrowsWhenClientIdNotFound.

@Test(expected = NotFoundException.class)
public void enrollThrowsWhenClientIdNotFound() {
    doThrow(IllegalStateException.class).when(aclDAO).findAndEnrollClient(6092384, group.getId(), auditLog, "user", new HashMap<>());
    resource.enrollClient(user, new LongParam("6092384"), new LongParam(Long.toString(group.getId())));
}
Also used : LongParam(io.dropwizard.jersey.params.LongParam) Test(org.junit.Test)

Aggregations

LongParam (io.dropwizard.jersey.params.LongParam)30 Test (org.junit.Test)30 Response (javax.ws.rs.core.Response)6 SecretDetailResponse (keywhiz.api.SecretDetailResponse)5 ClientDetailResponse (keywhiz.api.ClientDetailResponse)4 Group (keywhiz.api.model.Group)4 GroupDetailResponse (keywhiz.api.GroupDetailResponse)3 SanitizedSecret (keywhiz.api.model.SanitizedSecret)3 Client (keywhiz.api.model.Client)2 Secret (keywhiz.api.model.Secret)2 HashSet (java.util.HashSet)1 NotFoundException (javax.ws.rs.NotFoundException)1 KeywhizClient (keywhiz.client.KeywhizClient)1