use of org.uberfire.security.Contributor in project kie-wb-common by kiegroup.
the class BranchManagementPresenterTest method setupWithUpdatableBranchesTest.
@Test
public void setupWithUpdatableBranchesTest() {
final Map<String, RolePermissions> permissionsByRole = new HashMap<>();
permissionsByRole.put("CONTRIBUTOR", new RolePermissions("CONTRIBUTOR", true, false, true, true));
doReturn(new BranchPermissions("myBranch", permissionsByRole)).when(libraryService).loadBranchPermissions("mySpace", "myProject", "myBranch");
doReturn(promises.resolve(Arrays.asList(new Branch("main", mock(Path.class)), new Branch("myBranch", mock(Path.class))))).when(projectController).getUpdatableBranches(any());
presenter.setup(mock(ProjectScreenModel.class)).then(v -> {
assertEquals("myBranch", presenter.selectedBranch);
verify(view).init(presenter);
verify(view, never()).showEmptyState();
verify(view).setupBranchSelect(any(), any(), any());
verify(libraryService).loadBranchPermissions("mySpace", "myProject", "myBranch");
return promises.resolve();
}).catch_(error -> {
fail();
return promises.resolve();
});
}
Aggregations