use of ca.corefacility.bioinformatics.irida.security.permissions.project.ProjectOwnerPermission in project irida by phac-nml.
the class ProjectOwnerPermissionTest method setup.
@SuppressWarnings("unchecked")
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
user.setSystemRole(Role.ROLE_USER);
user.setUsername("tom");
permission = new ProjectOwnerPermission(projectRepository, userRepository, pujRepository, ugpjRepository, ugRepository);
when(projectRepository.findOne(projectId)).thenReturn(project);
when(userRepository.loadUserByUsername(user.getUsername())).thenReturn(user);
when(pujRepository.getUsersForProjectByRole(project, ProjectRole.PROJECT_OWNER)).thenReturn(Lists.newArrayList(new ProjectUserJoin(project, user, ProjectRole.PROJECT_OWNER)));
}
use of ca.corefacility.bioinformatics.irida.security.permissions.project.ProjectOwnerPermission in project irida by phac-nml.
the class UpdateSamplePermissionTest method setUp.
@Before
public void setUp() {
projectSampleJoinRepository = mock(ProjectSampleJoinRepository.class);
projectOwnerPermission = mock(ProjectOwnerPermission.class);
sampleRepository = mock(SampleRepository.class);
updateSamplePermission = new UpdateSamplePermission(sampleRepository, projectOwnerPermission, projectSampleJoinRepository);
Collection<GrantedAuthority> roles = new ArrayList<>();
roles.add(Role.ROLE_USER);
auth = new UsernamePasswordAuthenticationToken("fbristow", "password1", roles);
}
Aggregations