use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class SessionLoginResourceIntegrationTest method noFormDataIsBadRequest.
@Test
public void noFormDataIsBadRequest() throws Exception {
Request request = buildLoginPost(null, null);
Response response = client.newCall(request).execute();
assertThat(response.code()).isEqualTo(400);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class AutomationSecretAccessResourceIntegrationTest method allowAccess.
@Test
public void allowAccess() throws Exception {
//Allow "Web" to access "Hacking_Password"
Request put = new Request.Builder().put(RequestBody.create(MediaType.parse("text/plain"), "")).url(testUrl("/automation/secrets/738/groups/918")).build();
Response response = mutualSslClient.newCall(put).execute();
assertThat(response.code()).isEqualTo(200);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class AutomationSecretResourceIntegrationTest method readInvalidSecret.
@Test
public void readInvalidSecret() throws Exception {
Request get = new Request.Builder().get().url(testUrl("/automation/secrets?name=invalid")).build();
Response response = mutualSslClient.newCall(get).execute();
assertThat(response.code()).isEqualTo(404);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class AutomationSecretResourceIntegrationTest method addSecrets.
@Test
public void addSecrets() throws Exception {
CreateSecretRequest request = new CreateSecretRequest("new_secret", "desc", "superSecret", ImmutableMap.of(), 0);
String body = mapper.writeValueAsString(request);
Request post = new Request.Builder().post(RequestBody.create(KeywhizClient.JSON, body)).url(testUrl("/automation/secrets")).addHeader("Content-Type", MediaType.APPLICATION_JSON).build();
Response response = mutualSslClient.newCall(post).execute();
assertThat(response.code()).isEqualTo(200);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method secretListing.
List<String> secretListing(String client) throws IOException {
Request get = clientRequest(format("/automation/v2/clients/%s/secrets", client)).get().build();
Response httpResponse = mutualSslClient.newCall(get).execute();
assertThat(httpResponse.code()).isEqualTo(200);
return mapper.readValue(httpResponse.body().byteStream(), new TypeReference<List<String>>() {
});
}
Aggregations