use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method clientDelete_success.
@Test
public void clientDelete_success() throws Exception {
// Sample client
create(CreateClientRequestV2.builder().name("to-delete").build());
// Deleting is successful
Response httpResponse = delete("to-delete");
assertThat(httpResponse.code()).isEqualTo(204);
// Deleting again produces not-found
httpResponse = delete("to-delete");
assertThat(httpResponse.code()).isEqualTo(404);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method lookup.
ClientDetailResponseV2 lookup(String client) throws IOException {
Request get = clientRequest("/automation/v2/clients/" + client).get().build();
Response httpResponse = mutualSslClient.newCall(get).execute();
assertThat(httpResponse.code()).isEqualTo(200);
return mapper.readValue(httpResponse.body().byteStream(), ClientDetailResponseV2.class);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class ClientResourceTest method modifyGroups.
List<String> modifyGroups(String client, ModifyGroupsRequestV2 request) throws IOException {
RequestBody body = RequestBody.create(JSON, mapper.writeValueAsString(request));
Request put = clientRequest(format("/automation/v2/clients/%s/groups", client)).put(body).build();
Response httpResponse = mutualSslClient.newCall(put).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 modifyClientGroups_notFound.
@Test
public void modifyClientGroups_notFound() throws Exception {
ModifyGroupsRequestV2 request = ModifyGroupsRequestV2.builder().build();
RequestBody body = RequestBody.create(JSON, mapper.writeValueAsString(request));
Request put = clientRequest("/automation/v2/clients/non-existent/groups").put(body).build();
Response httpResponse = mutualSslClient.newCall(put).execute();
assertThat(httpResponse.code()).isEqualTo(404);
}
use of org.openclinica.ns.response.v31.Response in project keywhiz by square.
the class GroupResourceTest method secretsInfo.
Set<SanitizedSecret> secretsInfo(String group) throws IOException {
Request get = clientRequest("/automation/v2/groups/" + group + "/secrets").get().build();
Response httpResponse = mutualSslClient.newCall(get).execute();
assertThat(httpResponse.code()).isEqualTo(200);
return mapper.readValue(httpResponse.body().byteStream(), new TypeReference<Set<SanitizedSecret>>() {
});
}
Aggregations