Skip to content

Commit

Permalink
#99 - Covering unhappy path when secret_key is incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
mtakaki committed May 19, 2020
1 parent 14724a2 commit 75a8bcc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/plugins/test_token_provider.py
Expand Up @@ -95,6 +95,22 @@ def test_get_aws_secrets_manager(mock_boto3):
mock_boto3.get_secret_value.assert_called_with(SecretId="hq_token")


def test_get_aws_secrets_manager_incorrect_secret_key(mock_boto3):
mock_boto3.get_secret_value.return_value = {"SecretString": '{"token": "my_token"}'}
with pytest.raises(AwsSecretsManagerTokenRetrievalException):
get_token(
[
{
"secret_name": "hq_token",
"type": "AWS_SECRETS_MANAGER",
"region": "us-west-2",
"secret_key": "wrong_key",
}
]
)
mock_boto3.get_secret_value.assert_called_with(SecretId="hq_token")


def test_get_aws_secrets_manager_binary_secret(mock_boto3):
mock_boto3.get_secret_value.return_value = {"binary": "it_will_fail"}
with pytest.raises(AwsSecretsManagerTokenRetrievalException):
Expand Down

0 comments on commit 75a8bcc

Please sign in to comment.