use of org.motechproject.server.web.form.StartupForm in project motech by motech.
the class StartupControllerTest method testSubmitFormOpenId.
@Test
public void testSubmitFormOpenId() throws IOException {
StartupForm startupForm = startupForm();
startupForm.setProviderUrl("https://www.example.com/accounts/id");
startupForm.setLoginMode(LoginMode.OPEN_ID.getName());
when(startupManager.getDefaultSettings()).thenReturn(motechSettings);
when(configurationService.getPlatformSettings()).thenReturn(motechSettings);
List<String> result = startupController.submitForm(startupForm);
assertTrue(result.isEmpty());
verify(configurationService).savePlatformSettings(any(MotechSettings.class));
verify(startupManager).startup();
verify(userService, never()).registerMotechAdmin(anyString(), anyString(), anyString(), any(Locale.class));
}
use of org.motechproject.server.web.form.StartupForm in project motech by motech.
the class StartupControllerTest method testSubmitFormStart.
@Test
public void testSubmitFormStart() throws IOException {
StartupForm startupForm = startupForm();
startupForm.setLoginMode(LoginMode.REPOSITORY.getName());
when(startupManager.getDefaultSettings()).thenReturn(motechSettings);
when(configurationService.getPlatformSettings()).thenReturn(motechSettings);
List<String> result = startupController.submitForm(startupForm);
assertTrue(result.isEmpty());
verify(configurationService).savePlatformSettings(any(MotechSettings.class));
verify(startupManager).startup();
verifyUserRegistration();
}
use of org.motechproject.server.web.form.StartupForm in project motech by motech.
the class StartupControllerTest method startupForm.
private StartupForm startupForm() {
StartupForm startupForm = new StartupForm();
startupForm.setLanguage("en");
startupForm.setSchedulerUrl("test_scheduler_url");
startupForm.setAdminLogin("motech");
startupForm.setAdminEmail("motech@motech.com");
startupForm.setAdminPassword("motech");
startupForm.setAdminConfirmPassword("motech");
startupForm.setProviderName("Provider");
startupForm.setProviderUrl("test_provider_url");
return startupForm;
}
use of org.motechproject.server.web.form.StartupForm in project motech by motech.
the class StartupControllerTest method shouldNotAllowStartupPostAfterStartup.
@Test
public void shouldNotAllowStartupPostAfterStartup() throws IOException {
StartupForm form = startupForm();
form.setLoginMode(LoginMode.REPOSITORY.getName());
when(startupManager.getDefaultSettings()).thenReturn(motechSettings);
when(startupManager.canLaunchBundles()).thenReturn(true);
List<String> result = startupController.submitForm(form);
assertTrue(result.isEmpty());
verify(userService, never()).registerMotechAdmin(anyString(), anyString(), anyString(), any(Locale.class));
verify(startupManager, never()).startup();
}
use of org.motechproject.server.web.form.StartupForm in project motech by motech.
the class StartupControllerTest method shouldNotRegisterAdminUserIfActiveAdminUserAlreadyExists.
@Test
public void shouldNotRegisterAdminUserIfActiveAdminUserAlreadyExists() throws IOException {
StartupForm startupForm = startupForm();
startupForm.setLoginMode(LoginMode.REPOSITORY.getName());
when(startupManager.getDefaultSettings()).thenReturn(motechSettings);
when(startupManager.canLaunchBundles()).thenReturn(true);
when(configurationService.getPlatformSettings()).thenReturn(motechSettings);
when(userService.hasActiveMotechAdmin()).thenReturn(true);
startupController.submitForm(startupForm);
verify(userService, never()).registerMotechAdmin(anyString(), anyString(), anyString(), any(Locale.class));
}
Aggregations