use of keywhiz.api.automation.v2.ClientDetailResponseV2 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());
}
use of keywhiz.api.automation.v2.ClientDetailResponseV2 in project keywhiz by square.
the class ClientResourceTest method clientInfo_groupExists.
@Test
public void clientInfo_groupExists() throws Exception {
// Sample client
create(CreateClientRequestV2.builder().name("client3").build());
ClientDetailResponseV2 clientDetail = lookup("client3");
assertThat(clientDetail.name()).isEqualTo("client3");
assertThat(clientDetail.description()).isEmpty();
assertThat(clientDetail.createdBy()).isEqualTo(clientDetail.updatedBy()).isEqualTo("client");
}
use of keywhiz.api.automation.v2.ClientDetailResponseV2 in project keywhiz by square.
the class ClientResourceTest method createClient_duplicate.
@Test
public void createClient_duplicate() throws Exception {
CreateClientRequestV2 request = CreateClientRequestV2.builder().name("client2").build();
// Initial request OK
create(request);
// Duplicate request fails
Response httpResponse = create(request);
assertThat(httpResponse.code()).isEqualTo(409);
// The client was created by the first request
ClientDetailResponseV2 clientDetail = lookup("client2");
assertThat(clientDetail.name()).isEqualTo("client2");
assertThat(clientDetail.description()).isEmpty();
assertThat(clientDetail.createdBy()).isEqualTo(clientDetail.updatedBy()).isEqualTo("client");
assertThat(clientDetail.spiffeId()).isEmpty();
}
use of keywhiz.api.automation.v2.ClientDetailResponseV2 in project keywhiz by square.
the class ClientResourceTest method createClient_success.
@Test
public void createClient_success() throws Exception {
Response httpResponse = create(CreateClientRequestV2.builder().name("client1").description("description").spiffeId("spiffe//example.org/client1").build());
assertThat(httpResponse.code()).isEqualTo(201);
URI location = URI.create(Objects.requireNonNull(httpResponse.header(LOCATION)));
assertThat(location.getPath()).isEqualTo("/automation/v2/clients/client1");
ClientDetailResponseV2 clientDetail = lookup("client1");
assertThat(clientDetail.name()).isEqualTo("client1");
assertThat(clientDetail.description()).isEqualTo("description");
assertThat(clientDetail.createdBy()).isEqualTo(clientDetail.updatedBy()).isEqualTo("client");
assertThat(clientDetail.spiffeId()).isEqualTo("spiffe//example.org/client1");
}
Aggregations