use of com.quorum.tessera.config.keypairs.AzureVaultKeyPair in project tessera by ConsenSys.
the class AzureVaultKeyGeneratorTest method keysSavedInVaultWithProvidedVaultIdAndCorrectSuffix.
@Test
public void keysSavedInVaultWithProvidedVaultIdAndCorrectSuffix() {
final String vaultId = "vaultId";
final String pubVaultId = vaultId + "Pub";
final String privVaultId = vaultId + "Key";
final AzureVaultKeyPair result = azureVaultKeyGenerator.generate(vaultId, null, null);
final ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
verify(keyVaultService, times(2)).setSecret(captor.capture());
List<Map> capturedArgs = captor.getAllValues();
assertThat(capturedArgs).hasSize(2);
Map<String, String> expectedDataPub = Map.of("secretName", pubVaultId, "secret", pub.encodeToBase64());
Map<String, String> expectedDataPriv = Map.of("secretName", privVaultId, "secret", priv.encodeToBase64());
assertThat(capturedArgs).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder(expectedDataPub, expectedDataPriv);
verifyNoMoreInteractions(keyVaultService);
final AzureVaultKeyPair expected = new AzureVaultKeyPair(pubVaultId, privVaultId, null, null);
assertThat(result).isEqualToComparingFieldByFieldRecursively(expected);
}
Aggregations