use of io.imunity.furms.domain.resource_access.UserGrant in project furms by unity-idm.
the class ResourceAllocationDatabaseRepositoryTest method shouldFindUsersGrants.
@Test
void shouldFindUsersGrants() {
CorrelationId correlationId = CorrelationId.randomID();
UserGrantEntity userAllocation = userGrantEntityRepository.save(UserGrantEntity.builder().siteId(siteId).projectId(projectId).projectAllocationId(projectAllocationId).userId("userId").build());
UserGrantJobEntity userGrantJobEntity = UserGrantJobEntity.builder().userAllocationId(userAllocation.getId()).status(AccessStatus.GRANTED).correlationId(UUID.fromString(correlationId.id)).message("text").build();
userGrantJobEntityRepository.save(userGrantJobEntity);
Set<UserGrant> userGrants = resourceAccessDatabaseRepository.findUsersGrantsByProjectId(projectId.toString());
assertThat(userGrants.size()).isEqualTo(1);
UserGrant userGrant = userGrants.iterator().next();
assertThat(userGrant.userId).isEqualTo("userId");
assertThat(userGrant.projectAllocationId).isEqualTo(projectAllocationId.toString());
assertThat(userGrant.status).isEqualTo(AccessStatus.GRANTED);
assertThat(userGrant.errorMessage.get().message).isEqualTo("text");
}
Aggregations