use of org.odk.collect.android.formmanagement.ServerFormsDetailsFetcher in project collect by opendatakit.
the class DownloadFormListTaskTest method whenAlternateCredentialsAreSet_shouldServerFormsDetailsFetcherBeUpdated.
@Test
public void whenAlternateCredentialsAreSet_shouldServerFormsDetailsFetcherBeUpdated() {
ServerFormsDetailsFetcher serverFormsDetailsFetcher = mock(ServerFormsDetailsFetcher.class);
WebCredentialsUtils webCredentialsUtils = mock(WebCredentialsUtils.class);
DownloadFormListTask task = new DownloadFormListTask(serverFormsDetailsFetcher);
task.setAlternateCredentials(webCredentialsUtils, "https://test-server.com", "testUser", "testPassword");
verify(serverFormsDetailsFetcher).updateUrl("https://test-server.com");
verify(serverFormsDetailsFetcher).updateCredentials(webCredentialsUtils);
}
use of org.odk.collect.android.formmanagement.ServerFormsDetailsFetcher in project collect by opendatakit.
the class DownloadFormListTaskTest method whenAlternateCredentialsDoNotContainUrl_shouldNotUrlBeUpdated.
@Test
public void whenAlternateCredentialsDoNotContainUrl_shouldNotUrlBeUpdated() {
ServerFormsDetailsFetcher serverFormsDetailsFetcher = mock(ServerFormsDetailsFetcher.class);
WebCredentialsUtils webCredentialsUtils = mock(WebCredentialsUtils.class);
DownloadFormListTask task = new DownloadFormListTask(serverFormsDetailsFetcher);
task.setAlternateCredentials(webCredentialsUtils, null, "testUser", "testPassword");
verify(serverFormsDetailsFetcher, never()).updateUrl(anyString());
verify(serverFormsDetailsFetcher).updateCredentials(webCredentialsUtils);
task.setAlternateCredentials(webCredentialsUtils, "", "testUser", "testPassword");
verify(serverFormsDetailsFetcher, never()).updateUrl(anyString());
verify(serverFormsDetailsFetcher, times(2)).updateCredentials(webCredentialsUtils);
}
Aggregations