use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method createTenantThrowsAuthorizationException.
@Test
public void createTenantThrowsAuthorizationException() {
Tenant newTenant = MockProvider.createMockTenant();
String message = "exception expected";
when(identityServiceMock.newTenant(MockProvider.EXAMPLE_TENANT_ID)).thenThrow(new AuthorizationException(message));
given().body(TenantDto.fromTenant(newTenant)).contentType(ContentType.JSON).then().expect().statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(AuthorizationException.class.getSimpleName())).body("message", equalTo(message)).when().post(TENANT_CREATE_URL);
}
use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.
the class TenantRestServiceInteractionTest method createTenant.
@Test
public void createTenant() {
Tenant newTenant = MockProvider.createMockTenant();
when(identityServiceMock.newTenant(MockProvider.EXAMPLE_TENANT_ID)).thenReturn(newTenant);
given().body(TenantDto.fromTenant(mockTenant)).contentType(ContentType.JSON).then().expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(TENANT_CREATE_URL);
verify(identityServiceMock).newTenant(MockProvider.EXAMPLE_TENANT_ID);
verify(newTenant).setName(MockProvider.EXAMPLE_TENANT_NAME);
verify(identityServiceMock).saveTenant(newTenant);
}
Aggregations