Match AWS's change from smart-quote to ASCII quote
This commit is contained in:
parent
b19abbc63e
commit
7e468287a0
@ -14,23 +14,21 @@ class ResourceNotFoundException(SecretsManagerClientError):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Using specialised exception due to the use of a non-ASCII character
|
|
||||||
class SecretNotFoundException(SecretsManagerClientError):
|
class SecretNotFoundException(SecretsManagerClientError):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.code = 404
|
self.code = 404
|
||||||
super(SecretNotFoundException, self).__init__(
|
super(SecretNotFoundException, self).__init__(
|
||||||
"ResourceNotFoundException",
|
"ResourceNotFoundException",
|
||||||
message="Secrets Manager can\u2019t find the specified secret.",
|
message="Secrets Manager can't find the specified secret.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# Using specialised exception due to the use of a non-ASCII character
|
|
||||||
class SecretHasNoValueException(SecretsManagerClientError):
|
class SecretHasNoValueException(SecretsManagerClientError):
|
||||||
def __init__(self, version_stage):
|
def __init__(self, version_stage):
|
||||||
self.code = 404
|
self.code = 404
|
||||||
super(SecretHasNoValueException, self).__init__(
|
super(SecretHasNoValueException, self).__init__(
|
||||||
"ResourceNotFoundException",
|
"ResourceNotFoundException",
|
||||||
message="Secrets Manager can\u2019t find the specified secret "
|
message="Secrets Manager can't find the specified secret "
|
||||||
"value for staging label: {}".format(version_stage),
|
"value for staging label: {}".format(version_stage),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +45,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(
|
||||||
"Secrets Manager can\u2019t find the specified secret.",
|
"Secrets Manager can't find the specified secret.",
|
||||||
cm.exception.response["Error"]["Message"],
|
cm.exception.response["Error"]["Message"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ 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(
|
||||||
"Secrets Manager can\u2019t find the specified secret.",
|
"Secrets Manager can't find the specified secret.",
|
||||||
cm.exception.response["Error"]["Message"],
|
cm.exception.response["Error"]["Message"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -88,7 +88,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(
|
||||||
"Secrets Manager can\u2019t find the specified secret value for staging label: AWSCURRENT",
|
"Secrets Manager can't find the specified secret value for staging label: AWSCURRENT",
|
||||||
cm.exception.response["Error"]["Message"],
|
cm.exception.response["Error"]["Message"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,9 +48,7 @@ def test_get_secret_that_does_not_exist():
|
|||||||
headers={"X-Amz-Target": "secretsmanager.GetSecretValue"},
|
headers={"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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
@ -70,9 +68,7 @@ def test_get_secret_that_does_not_match():
|
|||||||
headers={"X-Amz-Target": "secretsmanager.GetSecretValue"},
|
headers={"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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
@ -95,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 (
|
assert (
|
||||||
json_data["message"]
|
json_data["message"]
|
||||||
== "Secrets Manager can\u2019t find the specified secret value for staging label: AWSCURRENT"
|
== "Secrets Manager can't find the specified secret value for staging label: AWSCURRENT"
|
||||||
)
|
)
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
@ -178,9 +174,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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
@ -202,9 +196,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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
@ -306,9 +298,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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
@ -330,9 +320,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 (
|
assert json_data["message"] == "Secrets Manager can't find the specified secret."
|
||||||
json_data["message"] == "Secrets Manager can\u2019t find the specified secret."
|
|
||||||
)
|
|
||||||
assert json_data["__type"] == "ResourceNotFoundException"
|
assert json_data["__type"] == "ResourceNotFoundException"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user