use of io.gravitee.rest.api.model.application.OAuthClientSettings in project gravitee-management-rest-api by gravitee-io.
the class ApplicationService_CreateTest method shouldNotCreateBecauseGrantTypesIsNotAllowed.
@Test(expected = ApplicationGrantTypesNotAllowedException.class)
public void shouldNotCreateBecauseGrantTypesIsNotAllowed() {
ApplicationSettings settings = new ApplicationSettings();
OAuthClientSettings clientSettings = new OAuthClientSettings();
clientSettings.setApplicationType("web");
clientSettings.setGrantTypes(Arrays.asList("foobar"));
settings.setoAuthClient(clientSettings);
ApplicationTypeEntity applicationType = mock(ApplicationTypeEntity.class);
when(applicationTypeService.getApplicationType(any())).thenReturn(applicationType);
when(newApplication.getSettings()).thenReturn(settings);
when(parameterService.findAsBoolean(Key.APPLICATION_REGISTRATION_ENABLED, "DEFAULT", ParameterReferenceType.ENVIRONMENT)).thenReturn(Boolean.TRUE);
when(parameterService.findAsBoolean(Key.APPLICATION_TYPE_WEB_ENABLED, "DEFAULT", ParameterReferenceType.ENVIRONMENT)).thenReturn(Boolean.TRUE);
applicationService.create(newApplication, USER_NAME);
}
use of io.gravitee.rest.api.model.application.OAuthClientSettings in project gravitee-management-rest-api by gravitee-io.
the class ApplicationService_CreateTest method shouldNotCreateBecauseAppTypeIsNotAllowed.
@Test(expected = IllegalStateException.class)
public void shouldNotCreateBecauseAppTypeIsNotAllowed() {
ApplicationSettings settings = new ApplicationSettings();
OAuthClientSettings clientSettings = new OAuthClientSettings();
clientSettings.setApplicationType("web");
settings.setoAuthClient(clientSettings);
when(newApplication.getSettings()).thenReturn(settings);
when(parameterService.findAsBoolean(Key.APPLICATION_REGISTRATION_ENABLED, "DEFAULT", ParameterReferenceType.ENVIRONMENT)).thenReturn(Boolean.TRUE);
applicationService.create(newApplication, USER_NAME);
}
Aggregations