use of com.nexblocks.authguard.service.model.AppBO in project AuthGuard by AuthGuard.
the class ApplicationsServiceImplTest method getById.
@Test
void getById() {
final AppBO app = random.nextObject(AppBO.class).withDeleted(false);
Mockito.when(applicationsRepository.getById(any())).thenReturn(CompletableFuture.completedFuture(Optional.of(serviceMapper.toDO(app))));
final Optional<AppBO> retrieved = applicationsService.getById("");
final List<PermissionBO> expectedPermissions = app.getPermissions().stream().map(permission -> permission.withEntityType(null)).collect(Collectors.toList());
assertThat(retrieved).isPresent();
assertThat(retrieved.get()).isEqualToIgnoringGivenFields(app.withPermissions(expectedPermissions), "permissions", "entityType");
}
use of com.nexblocks.authguard.service.model.AppBO in project AuthGuard by AuthGuard.
the class DefaultApiKeyExchangeTest method generateKey.
@Test
void generateKey() {
final AppBO app = AppBO.builder().id("app").build();
final AuthResponseBO expected = AuthResponseBO.builder().type("api_key").entityType(EntityType.APPLICATION).entityId(app.getId()).build();
final AuthResponseBO actual = exchange.generateKey(app);
assertThat(actual).isEqualToIgnoringGivenFields(expected, "token");
assertThat(actual.getToken()).isNotNull();
}
Aggregations