use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method deleteTenantThrowsAuthorizationException.
@Test
public void deleteTenantThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(identityServiceMock).deleteTenant(MockProvider.EXAMPLE_TENANT_ID);
given().pathParam("id", MockProvider.EXAMPLE_TENANT_ID).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().delete(TENANT_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method deleteTenantGroupMembershipThrowsAuthorizationException.
@Test
public void deleteTenantGroupMembershipThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(identityServiceMock).deleteTenantGroupMembership(MockProvider.EXAMPLE_TENANT_ID, MockProvider.EXAMPLE_GROUP_ID);
given().pathParam("id", MockProvider.EXAMPLE_TENANT_ID).pathParam("groupId", MockProvider.EXAMPLE_GROUP_ID).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().delete(TENANT_GROUP_MEMBER_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testDeleteUserThrowsAuthorizationException.
@Test
public void testDeleteUserThrowsAuthorizationException() {
String message = "expected exception";
doThrow(new AuthorizationException(message)).when(identityServiceMock).deleteUser(MockProvider.EXAMPLE_USER_ID);
given().pathParam("id", MockProvider.EXAMPLE_USER_ID).then().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().delete(USER_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class UserRestServiceInteractionTest method testPutProfileThrowsAuthorizationException.
@Test
public void testPutProfileThrowsAuthorizationException() {
User initialUser = MockProvider.createMockUser();
User userUpdate = MockProvider.createMockUserUpdate();
UserQuery sampleUserQuery = mock(UserQuery.class);
when(identityServiceMock.createUserQuery()).thenReturn(sampleUserQuery);
when(sampleUserQuery.userId(MockProvider.EXAMPLE_USER_ID)).thenReturn(sampleUserQuery);
when(sampleUserQuery.singleResult()).thenReturn(initialUser);
String message = "exception expected";
doThrow(new AuthorizationException(message)).when(identityServiceMock).saveUser(any(User.class));
UserProfileDto updateDto = UserProfileDto.fromUser(userUpdate);
given().pathParam("id", MockProvider.EXAMPLE_USER_ID).body(updateDto).contentType(ContentType.JSON).then().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().put(USER_PROFILE_URL);
}
use of org.camunda.bpm.engine.AuthorizationException in project camunda-bpm-platform by camunda.
the class TaskReportRestServiceTest method testMissingAuthorization.
@Test
public void testMissingAuthorization() {
String message = "not authorized";
when(mockedReportQuery.taskCountByCandidateGroup()).thenThrow(new AuthorizationException(message));
given().then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().get(CANDIDATE_GROUP_REPORT_URL);
}
Aggregations