Search in sources :

Example 6 with Permits

use of org.ovirt.engine.api.model.Permits 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

Permits (org.ovirt.engine.api.model.Permits)6 Permit (org.ovirt.engine.api.model.Permit)4 Role (org.ovirt.engine.api.model.Role)4 Test (org.junit.Test)3 WebApplicationException (javax.ws.rs.WebApplicationException)2 Response (javax.ws.rs.core.Response)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 V3Permits (org.ovirt.engine.api.v3.types.V3Permits)1 V3Role (org.ovirt.engine.api.v3.types.V3Role)1 ActionGroup (org.ovirt.engine.core.common.businessentities.ActionGroup)1 ServerCpu (org.ovirt.engine.core.common.businessentities.ServerCpu)1