use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretDeliveryResourceIntegrationTest method returnsUnauthorizedWhenDenied.
@Test
public void returnsUnauthorizedWhenDenied() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secret/Hacking_Password")).build();
Response response = client.newCall(get).execute();
assertThat(response.code()).isEqualTo(403);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SecretDeliveryResourceIntegrationTest method returnsNotFoundWhenSecretDoesNotExist.
@Test
public void returnsNotFoundWhenSecretDoesNotExist() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/secret/nonexistent")).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 ClientResourceTest method modifyClient_notFound.
@Test
public void modifyClient_notFound() throws Exception {
ModifyClientRequestV2 request = ModifyClientRequestV2.forName("non-existent");
RequestBody body = RequestBody.create(JSON, mapper.writeValueAsString(request));
Request post = clientRequest("/automation/v2/clients/non-existent").post(body).build();
Response httpResponse = mutualSslClient.newCall(post).execute();
assertThat(httpResponse.code()).isEqualTo(404);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method groupListing.
List<String> groupListing(String client) throws IOException {
Request get = clientRequest(format("/automation/v2/clients/%s/groups", client)).get().build();
Response httpResponse = mutualSslClient.newCall(get).execute();
assertThat(httpResponse.code()).isEqualTo(200);
return mapper.readValue(httpResponse.body().byteStream(), new TypeReference<List<String>>() {
});
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method clientGroupsListing_notFound.
@Test
public void clientGroupsListing_notFound() throws Exception {
Request get = clientRequest("/automation/v2/clients/non-existent/groups").get().build();
Response httpResponse = mutualSslClient.newCall(get).execute();
assertThat(httpResponse.code()).isEqualTo(404);
}
Aggregations