use of keywhiz.api.automation.v2.SecretContentsResponseV2 in project keywhiz by square.
the class SecretResourceTest method secretContents_empty.
// ---------------------------------------------------------------------------------------
// secretContents
// ---------------------------------------------------------------------------------------
@Test
public void secretContents_empty() throws Exception {
// No error expected when the list of requested secrets is empty
SecretContentsResponseV2 resp = contents(SecretContentsRequestV2.fromParts(ImmutableSet.of()));
assertThat(resp.successSecrets().isEmpty()).isTrue();
assertThat(resp.missingSecrets().isEmpty()).isTrue();
}
use of keywhiz.api.automation.v2.SecretContentsResponseV2 in project keywhiz by square.
the class SecretResourceTest method secretContents_success.
@Test
public void secretContents_success() throws Exception {
// Sample secrets
create(CreateSecretRequestV2.builder().name("secret23a").content(encoder.encodeToString("supa secret23a".getBytes(UTF_8))).description("desc").metadata(ImmutableMap.of("owner", "root", "mode", "0440")).type("password").build());
create(CreateSecretRequestV2.builder().name("secret23b").content(encoder.encodeToString("supa secret23b".getBytes(UTF_8))).description("desc").build());
SecretContentsRequestV2 request = SecretContentsRequestV2.fromParts(ImmutableSet.of("secret23a", "secret23b", "non-existent"));
SecretContentsResponseV2 response = contents(request);
assertThat(response.successSecrets()).isEqualTo(ImmutableMap.of("secret23a", encoder.encodeToString("supa secret23a".getBytes(UTF_8)), "secret23b", encoder.encodeToString("supa secret23b".getBytes(UTF_8))));
assertThat(response.missingSecrets()).isEqualTo(ImmutableList.of("non-existent"));
}
Aggregations