From 6120a60263b215862941dfc0e2b5fd132bd00261 Mon Sep 17 00:00:00 2001 From: Alexander Campbell Date: Fri, 18 Oct 2019 10:13:22 +1100 Subject: [PATCH] Use escape sequence to express non-ASCII character --- moto/secretsmanager/models.py | 2 +- tests/test_secretsmanager/test_secretsmanager.py | 7 ++++--- tests/test_secretsmanager/test_server.py | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/moto/secretsmanager/models.py b/moto/secretsmanager/models.py index 2a3e7ede4..1e9d6a518 100644 --- a/moto/secretsmanager/models.py +++ b/moto/secretsmanager/models.py @@ -88,7 +88,7 @@ class SecretsManagerBackend(BaseBackend): if 'secret_string' not in secret_version and 'secret_binary' not in secret_version: raise ResourceNotFoundException( - u"Secrets Manager can’t 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") ) diff --git a/tests/test_secretsmanager/test_secretsmanager.py b/tests/test_secretsmanager/test_secretsmanager.py index 7319241d3..e2fc266ea 100644 --- a/tests/test_secretsmanager/test_secretsmanager.py +++ b/tests/test_secretsmanager/test_secretsmanager.py @@ -43,7 +43,7 @@ def test_get_secret_that_does_not_exist(): result = conn.get_secret_value(SecretId='i-dont-exist') assert_equal( - u"Secrets Manager can’t find the specified secret.", + u"Secrets Manager can\u2019t find the specified secret.", 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') assert_equal( - u"Secrets Manager can’t find the specified secret.", + u"Secrets Manager can\u2019t find the specified secret.", cm.exception.response['Error']['Message'] ) + @mock_secretsmanager def test_get_secret_value_that_is_marked_deleted(): 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') assert_equal( - u"Secrets Manager can’t 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'] ) diff --git a/tests/test_secretsmanager/test_server.py b/tests/test_secretsmanager/test_server.py index 552ed6a92..6955d8232 100644 --- a/tests/test_secretsmanager/test_server.py +++ b/tests/test_secretsmanager/test_server.py @@ -50,7 +50,7 @@ def test_get_secret_that_does_not_exist(): "X-Amz-Target": "secretsmanager.GetSecretValue"}, ) json_data = json.loads(get_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager @@ -71,7 +71,7 @@ def test_get_secret_that_does_not_match(): "X-Amz-Target": "secretsmanager.GetSecretValue"}, ) json_data = json.loads(get_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager @@ -91,7 +91,7 @@ def test_get_secret_that_has_no_value(): ) json_data = json.loads(get_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t 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' @mock_secretsmanager @@ -179,7 +179,7 @@ def test_describe_secret_that_does_not_exist(): ) json_data = json.loads(describe_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager @@ -203,7 +203,7 @@ def test_describe_secret_that_does_not_match(): ) json_data = json.loads(describe_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager @@ -304,7 +304,7 @@ def test_rotate_secret_that_does_not_exist(): ) json_data = json.loads(rotate_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager @@ -328,7 +328,7 @@ def test_rotate_secret_that_does_not_match(): ) json_data = json.loads(rotate_secret.data.decode("utf-8")) - assert json_data['message'] == u"Secrets Manager can’t find the specified secret." + assert json_data['message'] == u"Secrets Manager can\u2019t find the specified secret." assert json_data['__type'] == 'ResourceNotFoundException' @mock_secretsmanager