Example #1
0
 def test_get_secret_value_not_found(self, mock_client):
     """
     Test that if a non-existent secret returns None
     """
     mock_client.get_secret.side_effect = ResourceNotFoundError
     backend = AzureKeyVaultBackend()
     assert (backend._get_secret(path_prefix=backend.connections_prefix,
                                 secret_id='test_non_existent') is None)
Example #2
0
 def test_get_secret_value(self, mock_client):
     """
     Test that get_secret returns the secret value
     """
     mock_client.get_secret.return_value = mock.Mock(value='super-secret')
     backend = AzureKeyVaultBackend()
     secret_val = backend._get_secret('af-secrets', 'test_mysql_password')
     mock_client.get_secret.assert_called_with(name='af-secrets-test-mysql-password')
     self.assertEqual(secret_val, 'super-secret')