Use escape sequence to express non-ASCII character

This commit is contained in:
Alexander Campbell 2019-10-18 10:13:22 +11:00
parent 4eb921480e
commit 6120a60263
3 changed files with 12 additions and 11 deletions

View File

@ -88,7 +88,7 @@ class SecretsManagerBackend(BaseBackend):
if 'secret_string' not in secret_version and 'secret_binary' not in secret_version: if 'secret_string' not in secret_version and 'secret_binary' not in secret_version:
raise ResourceNotFoundException( raise ResourceNotFoundException(
u"Secrets Manager cant find the specified secret value for staging label: %s" % u"Secrets Manager can\u2019t find the specified secret value for staging label: %s" %
(version_stage or u"AWSCURRENT") (version_stage or u"AWSCURRENT")
) )

View File

@ -43,7 +43,7 @@ def test_get_secret_that_does_not_exist():
result = conn.get_secret_value(SecretId='i-dont-exist') result = conn.get_secret_value(SecretId='i-dont-exist')
assert_equal( assert_equal(
u"Secrets Manager cant find the specified secret.", u"Secrets Manager can\u2019t find the specified secret.",
cm.exception.response['Error']['Message'] cm.exception.response['Error']['Message']
) )
@ -58,10 +58,11 @@ def test_get_secret_that_does_not_match():
result = conn.get_secret_value(SecretId='i-dont-match') result = conn.get_secret_value(SecretId='i-dont-match')
assert_equal( assert_equal(
u"Secrets Manager cant find the specified secret.", u"Secrets Manager can\u2019t find the specified secret.",
cm.exception.response['Error']['Message'] cm.exception.response['Error']['Message']
) )
@mock_secretsmanager @mock_secretsmanager
def test_get_secret_value_that_is_marked_deleted(): def test_get_secret_value_that_is_marked_deleted():
conn = boto3.client('secretsmanager', region_name='us-west-2') conn = boto3.client('secretsmanager', region_name='us-west-2')
@ -85,7 +86,7 @@ def test_get_secret_that_has_no_value():
result = conn.get_secret_value(SecretId='java-util-test-password') result = conn.get_secret_value(SecretId='java-util-test-password')
assert_equal( assert_equal(
u"Secrets Manager cant find the specified secret value for staging label: AWSCURRENT", u"Secrets Manager can\u2019t find the specified secret value for staging label: AWSCURRENT",
cm.exception.response['Error']['Message'] cm.exception.response['Error']['Message']
) )

View File

@ -50,7 +50,7 @@ def test_get_secret_that_does_not_exist():
"X-Amz-Target": "secretsmanager.GetSecretValue"}, "X-Amz-Target": "secretsmanager.GetSecretValue"},
) )
json_data = json.loads(get_secret.data.decode("utf-8")) json_data = json.loads(get_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -71,7 +71,7 @@ def test_get_secret_that_does_not_match():
"X-Amz-Target": "secretsmanager.GetSecretValue"}, "X-Amz-Target": "secretsmanager.GetSecretValue"},
) )
json_data = json.loads(get_secret.data.decode("utf-8")) json_data = json.loads(get_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -91,7 +91,7 @@ def test_get_secret_that_has_no_value():
) )
json_data = json.loads(get_secret.data.decode("utf-8")) json_data = json.loads(get_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret value for staging label: AWSCURRENT" assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret value for staging label: AWSCURRENT"
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -179,7 +179,7 @@ def test_describe_secret_that_does_not_exist():
) )
json_data = json.loads(describe_secret.data.decode("utf-8")) json_data = json.loads(describe_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -203,7 +203,7 @@ def test_describe_secret_that_does_not_match():
) )
json_data = json.loads(describe_secret.data.decode("utf-8")) json_data = json.loads(describe_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -304,7 +304,7 @@ def test_rotate_secret_that_does_not_exist():
) )
json_data = json.loads(rotate_secret.data.decode("utf-8")) json_data = json.loads(rotate_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager
@ -328,7 +328,7 @@ def test_rotate_secret_that_does_not_match():
) )
json_data = json.loads(rotate_secret.data.decode("utf-8")) json_data = json.loads(rotate_secret.data.decode("utf-8"))
assert json_data['message'] == u"Secrets Manager cant find the specified secret." assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret."
assert json_data['__type'] == 'ResourceNotFoundException' assert json_data['__type'] == 'ResourceNotFoundException'
@mock_secretsmanager @mock_secretsmanager