use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretDeliveryResourceIntegrationTest method returnsNotFoundWhenSecretUnspecified.
@Test
public void returnsNotFoundWhenSecretUnspecified() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secret/")).build();
Response response = client.newCall(get).execute();
assertThat(response.code()).isEqualTo(404);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretsDeliveryResourceIntegrationTest method returnsUnauthorizedWhenUnauthenticated.
@Test
public void returnsUnauthorizedWhenUnauthenticated() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secrets")).build();
Response response = clientNoClientCert.newCall(get).execute();
assertThat(response.code()).isEqualTo(401);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretsDeliveryResourceIntegrationTest method returnsEmptyJsonArrayWhenUserHasNoSecrets.
@Test
public void returnsEmptyJsonArrayWhenUserHasNoSecrets() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secrets")).build();
Response response = noSecretsClient.newCall(get).execute();
assertThat(response.code()).isEqualTo(200);
assertThat(response.body().string()).isEqualTo("[]");
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretsDeliveryResourceIntegrationTest method returnsJsonArray.
@Test
public void returnsJsonArray() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secrets")).build();
Response response = client.newCall(get).execute();
assertThat(response.code()).isEqualTo(200);
assertThat(response.body().string()).startsWith("[").endsWith("]");
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class StatusResourceIntegrationTest method successWhenHealthy.
@Test
public void successWhenHealthy() throws Exception {
Request request = new Request.Builder().url("http://localhost:8081/status/enable").post(RequestBody.create(MediaType.parse("text/plain"), "")).build();
Response disableResponse = httpClient.newCall(request).execute();
assertThat(disableResponse.code()).isEqualTo(200);
Thread.sleep(3500);
assertThat(isHealthy()).isTrue();
}
Aggregations