Search in sources :

Example 1 with ConfigurationIdentitiesResponse

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());
}
Also used : PortalSettingsEntity(io.gravitee.rest.api.model.settings.PortalSettingsEntity) ConfigurationIdentitiesResponse(io.gravitee.rest.api.portal.rest.model.ConfigurationIdentitiesResponse) Response(javax.ws.rs.core.Response) IdentityProviderActivationEntity(io.gravitee.rest.api.model.configuration.identity.IdentityProviderActivationEntity) ConfigurationIdentitiesResponse(io.gravitee.rest.api.portal.rest.model.ConfigurationIdentitiesResponse) Test(org.junit.Test)

Aggregations

IdentityProviderActivationEntity (io.gravitee.rest.api.model.configuration.identity.IdentityProviderActivationEntity)1 PortalSettingsEntity (io.gravitee.rest.api.model.settings.PortalSettingsEntity)1 ConfigurationIdentitiesResponse (io.gravitee.rest.api.portal.rest.model.ConfigurationIdentitiesResponse)1 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1