use of keywhiz.api.automation.v2.CreateSecretRequestV2 in project keywhiz by square.
the class SecretResourceTest method modifySecretGroups_success.
@Test
public void modifySecretGroups_success() throws Exception {
// Create sample secret and groups
createGroup("group8a");
createGroup("group8b");
createGroup("group8c");
create(CreateSecretRequestV2.builder().name("secret8").content(encoder.encodeToString("supa secret8".getBytes(UTF_8))).groups("group8a", "group8b").build());
// Modify secret
ModifyGroupsRequestV2 request = ModifyGroupsRequestV2.builder().addGroups("group8c", "non-existent1").removeGroups("group8a", "non-existent2").build();
List<String> groups = modifyGroups("secret8", request);
assertThat(groups).containsOnly("group8b", "group8c");
}
use of keywhiz.api.automation.v2.CreateSecretRequestV2 in project keywhiz by square.
the class SecretResourceTest method createSecret_duplicateUnVersioned.
@Test
public void createSecret_duplicateUnVersioned() throws Exception {
CreateSecretRequestV2 request = CreateSecretRequestV2.builder().name("secret2").content(encoder.encodeToString("supa secret2".getBytes(UTF_8))).description("desc").build();
Response httpResponse = create(request);
assertThat(httpResponse.code()).isEqualTo(201);
httpResponse = create(request);
assertThat(httpResponse.code()).isEqualTo(409);
}
Aggregations