use of pro.taskana.WorkbasketPermission in project taskana by Taskana.
the class WorkbasketServiceImplTest method testGetWorkbasketByKey.
@Test
public void testGetWorkbasketByKey() throws NotAuthorizedException, WorkbasketNotFoundException {
String wbKey = "Key-1";
Workbasket wb = createTestWorkbasket("ID-1", wbKey);
WorkbasketPermission authorization = WorkbasketPermission.READ;
doNothing().when(cutSpy).checkAuthorization(wbKey, "test", authorization);
doReturn(wb).when(workbasketMapperMock).findByKeyAndDomain(wbKey, "test");
Workbasket actualWb = cutSpy.getWorkbasket(wbKey, "test");
verify(taskanaEngineImplMock, times(1)).openConnection();
verify(cutSpy, times(1)).checkAuthorization(wbKey, "test", authorization);
verify(workbasketMapperMock, times(1)).findByKeyAndDomain(wbKey, "test");
verify(taskanaEngineImplMock, times(1)).returnConnection();
verify(taskanaEngineImplMock, times(1)).isUserInRole(any());
verifyNoMoreInteractions(taskQueryMock, taskServiceMock, workbasketMapperMock, workbasketAccessMapperMock, distributionTargetMapperMock, taskanaEngineImplMock, taskanaEngineConfigurationMock);
assertThat(actualWb, equalTo(wb));
}
Aggregations