Search in sources :

Example 1 with ModifyClientRequestV2

use of keywhiz.api.automation.v2.ModifyClientRequestV2 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);
}
Also used : Response(okhttp3.Response) ModifyClientRequestV2(keywhiz.api.automation.v2.ModifyClientRequestV2) Request(okhttp3.Request) TestClients.clientRequest(keywhiz.TestClients.clientRequest) RequestBody(okhttp3.RequestBody) Test(org.junit.Test)

Example 2 with ModifyClientRequestV2

use of keywhiz.api.automation.v2.ModifyClientRequestV2 in project keywhiz by square.

the class ClientResourceTest method modifyClient_success.

@Ignore
@Test
public void modifyClient_success() throws Exception {
    // Create sample client
    create(CreateClientRequestV2.builder().name("client9").build());
    ClientDetailResponseV2 originalClient = lookup("client9");
    // Modify client
    ModifyClientRequestV2 request = ModifyClientRequestV2.forName("client9b");
    ClientDetailResponseV2 clientDetail = modify("client9", request);
    assertThat(clientDetail.name()).isEqualTo("client9b");
    assertThat(clientDetail).isEqualToIgnoringGivenFields(originalClient, "name", "updateDate");
    assertThat(clientDetail.updatedAtSeconds()).isGreaterThan(originalClient.updatedAtSeconds());
}
Also used : ClientDetailResponseV2(keywhiz.api.automation.v2.ClientDetailResponseV2) ModifyClientRequestV2(keywhiz.api.automation.v2.ModifyClientRequestV2) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ModifyClientRequestV2 (keywhiz.api.automation.v2.ModifyClientRequestV2)2 Test (org.junit.Test)2 TestClients.clientRequest (keywhiz.TestClients.clientRequest)1 ClientDetailResponseV2 (keywhiz.api.automation.v2.ClientDetailResponseV2)1 Request (okhttp3.Request)1 RequestBody (okhttp3.RequestBody)1 Response (okhttp3.Response)1 Ignore (org.junit.Ignore)1