use of com.github.robozonky.api.confirmations.RequestId in project robozonky by RoboZonky.
the class ZonkoidConfirmationProviderTest method properHttpPost.
@Test
void properHttpPost() throws UnsupportedEncodingException {
final int loanId = 1;
final RequestId r = new RequestId("user@somewhere.cz", "apitest".toCharArray());
final HttpPost post = ZonkoidConfirmationProvider.getRequest(r, loanId, 200, "https", "somewhere");
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(post.getFirstHeader("Accept").getValue()).isEqualTo("text/plain");
softly.assertThat(post.getFirstHeader("Authorization").getValue()).isNotEmpty().isEqualTo(ZonkoidConfirmationProvider.getAuthenticationString(r, loanId));
softly.assertThat(post.getFirstHeader("Content-Type").getValue()).isEqualTo("application/x-www-form-urlencoded");
softly.assertThat(post.getEntity()).isInstanceOf(UrlEncodedFormEntity.class);
softly.assertThat(post.getFirstHeader("User-Agent").getValue()).isEqualTo(Defaults.ROBOZONKY_USER_AGENT);
});
}
use of com.github.robozonky.api.confirmations.RequestId in project robozonky by RoboZonky.
the class ConfirmationProviderLoaderTest method loading.
@Test
void loading() {
final String id = UUID.randomUUID().toString();
final ConfirmationProvider cp = new ConfirmationProvider() {
@Override
public boolean requestConfirmation(final RequestId auth, final int loanId, final int amount) {
return false;
}
@Override
public String getId() {
return id;
}
};
final ConfirmationProviderService cps = strategy -> Optional.of(cp);
assertThat(ConfirmationProviderLoader.load(id, Collections.singleton(cps))).contains(cp);
}
use of com.github.robozonky.api.confirmations.RequestId in project robozonky by RoboZonky.
the class ZonkoidConfirmationProviderTest method execute.
private boolean execute(final int code) {
this.mockServerResponse(code);
final boolean result = ZonkoidConfirmationProvider.requestConfirmation(new RequestId("user@somewhere.cz", "apitest".toCharArray()), 1, 200, serverUrl);
this.verifyClientRequest();
return result;
}
Aggregations