Search in sources :

Example 6 with Permit

use of org.ovirt.engine.api.model.Permit in project ovirt-engine by oVirt.

the class BackendRolesResourceTest method testAddRoleInvalidPermit.

@Test
public void testAddRoleInvalidPermit() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Role model = new Role();
    model.setName(NAMES[0]);
    model.setPermits(new Permits());
    model.getPermits().getPermits().add(new Permit());
    model.getPermits().getPermits().get(0).setId("1234");
    try {
        Response response = collection.add(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        assertEquals(BAD_REQUEST, wae.getResponse().getStatus());
        assertEquals("1234 is not a valid permit ID.", wae.getResponse().getEntity());
    }
}
Also used : Role(org.ovirt.engine.api.model.Role) Response(javax.ws.rs.core.Response) Permit(org.ovirt.engine.api.model.Permit) WebApplicationException(javax.ws.rs.WebApplicationException) Permits(org.ovirt.engine.api.model.Permits) Test(org.junit.Test)

Aggregations

Permit (org.ovirt.engine.api.model.Permit)6 Test (org.junit.Test)4 Permits (org.ovirt.engine.api.model.Permits)4 Response (javax.ws.rs.core.Response)3 Role (org.ovirt.engine.api.model.Role)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 ClusterLevel (org.ovirt.engine.api.model.ClusterLevel)1 CpuType (org.ovirt.engine.api.model.CpuType)1 CpuTypes (org.ovirt.engine.api.model.CpuTypes)1 ActionGroup (org.ovirt.engine.core.common.businessentities.ActionGroup)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1