Search in sources :

Example 6 with WorkbasketPermission

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));
}
Also used : WorkbasketPermission(pro.taskana.WorkbasketPermission) Workbasket(pro.taskana.Workbasket) Test(org.junit.Test)

Aggregations

WorkbasketPermission (pro.taskana.WorkbasketPermission)6 Test (org.junit.Test)5 Workbasket (pro.taskana.Workbasket)4 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)2 AbstractAccTest (acceptance.AbstractAccTest)1 ArrayList (java.util.ArrayList)1 WorkbasketAccessItem (pro.taskana.WorkbasketAccessItem)1 WorkbasketService (pro.taskana.WorkbasketService)1 WithAccessId (pro.taskana.security.WithAccessId)1