Add some extra validation in integration tests
This commit is contained in:
parent
7a907bb44d
commit
daa897db93
|
@ -50,6 +50,7 @@ import org.whispersystems.textsecuregcm.entities.RegistrationRequest;
|
||||||
import org.whispersystems.textsecuregcm.http.FaultTolerantHttpClient;
|
import org.whispersystems.textsecuregcm.http.FaultTolerantHttpClient;
|
||||||
import org.whispersystems.textsecuregcm.storage.Device;
|
import org.whispersystems.textsecuregcm.storage.Device;
|
||||||
import org.whispersystems.textsecuregcm.util.HeaderUtils;
|
import org.whispersystems.textsecuregcm.util.HeaderUtils;
|
||||||
|
import org.whispersystems.textsecuregcm.util.HttpUtils;
|
||||||
import org.whispersystems.textsecuregcm.util.SystemMapper;
|
import org.whispersystems.textsecuregcm.util.SystemMapper;
|
||||||
import javax.validation.ConstraintViolation;
|
import javax.validation.ConstraintViolation;
|
||||||
|
|
||||||
|
@ -249,7 +250,7 @@ public final class Operations {
|
||||||
public Pair<Integer, Void> executeExpectSuccess() {
|
public Pair<Integer, Void> executeExpectSuccess() {
|
||||||
final Pair<Integer, Void> execute = execute();
|
final Pair<Integer, Void> execute = execute();
|
||||||
Validate.isTrue(
|
Validate.isTrue(
|
||||||
execute.getLeft() >= 200 && execute.getLeft() < 300,
|
HttpUtils.isSuccessfulResponse(execute.getLeft()),
|
||||||
"Unexpected response code: %d",
|
"Unexpected response code: %d",
|
||||||
execute.getLeft());
|
execute.getLeft());
|
||||||
return execute;
|
return execute;
|
||||||
|
@ -257,6 +258,10 @@ public final class Operations {
|
||||||
|
|
||||||
public <T> T executeExpectSuccess(final Class<T> expectedType) {
|
public <T> T executeExpectSuccess(final Class<T> expectedType) {
|
||||||
final Pair<Integer, T> execute = execute(expectedType);
|
final Pair<Integer, T> execute = execute(expectedType);
|
||||||
|
Validate.isTrue(
|
||||||
|
HttpUtils.isSuccessfulResponse(execute.getLeft()),
|
||||||
|
"Unexpected response code: %d : %s",
|
||||||
|
execute.getLeft(), execute.getRight());
|
||||||
return requireNonNull(execute.getRight());
|
return requireNonNull(execute.getRight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
package org.signal.integration;
|
package org.signal.integration;
|
||||||
|
|
||||||
|
import io.micrometer.common.util.StringUtils;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.whispersystems.textsecuregcm.entities.CreateVerificationSessionRequest;
|
import org.whispersystems.textsecuregcm.entities.CreateVerificationSessionRequest;
|
||||||
|
@ -29,6 +30,8 @@ public class RegistrationTest {
|
||||||
.executeExpectSuccess(VerificationSessionResponse.class);
|
.executeExpectSuccess(VerificationSessionResponse.class);
|
||||||
|
|
||||||
final String sessionId = verificationSessionResponse.id();
|
final String sessionId = verificationSessionResponse.id();
|
||||||
|
Assertions.assertTrue(StringUtils.isNotBlank(sessionId));
|
||||||
|
|
||||||
final String pushChallenge = Operations.peekVerificationSessionPushChallenge(sessionId);
|
final String pushChallenge = Operations.peekVerificationSessionPushChallenge(sessionId);
|
||||||
|
|
||||||
// supply push challenge
|
// supply push challenge
|
||||||
|
|
Loading…
Reference in New Issue