use of io.gravitee.rest.api.portal.rest.model.ConfigurationIdentitiesResponse in project gravitee-management-rest-api by gravitee-io.
the class ConfigurationIdentitiesResourceTest method shouldGetConfigurationIdentities.
@Test
public void shouldGetConfigurationIdentities() {
resetAllMocks();
IdentityProviderActivationEntity activatedIdp = new IdentityProviderActivationEntity();
activatedIdp.setIdentityProvider(IDP_ID);
doReturn(Sets.newSet(activatedIdp)).when(identityProviderActivationService).findAllByTarget(any());
doReturn(Sets.newSet(mockAMIdentityProviderEntity(), mockGoogleIdentityProviderEntity(), mockGitHubIdentityProviderEntity(), mockOIDCIdentityProviderEntity())).when(socialIdentityProviderService).findAll(any());
PortalSettingsEntity configEntity = new PortalSettingsEntity();
doReturn(configEntity).when(configService).getPortalSettings();
final Response response = target().request().get();
assertEquals(HttpStatusCode.OK_200, response.getStatus());
verify(identityProviderMapper, times(4)).convert(any());
verify(socialIdentityProviderService).findAll(any());
ConfigurationIdentitiesResponse configurationIdentitiesResponse = response.readEntity(ConfigurationIdentitiesResponse.class);
assertEquals(4, configurationIdentitiesResponse.getData().size());
}
Aggregations