Update SNS get_endpoint_attributes response for Not Found endpoints (#3637)
The response returned for sns.get_endpoint_attributes was not in sync with the actual response from boto. Co-authored-by: Antillon, Alejandro <alejandro.antillon@f-secure.com>
This commit is contained in:
parent
cd044ef00b
commit
e9dc5edf7f
3 changed files with 28 additions and 3 deletions
|
|
@ -1,12 +1,24 @@
|
|||
from __future__ import unicode_literals
|
||||
from moto.core.exceptions import RESTError
|
||||
|
||||
NOT_FOUND_ENDPOINT_ERROR = """<ErrorResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
|
||||
<Error>
|
||||
<Type>{{ sender }}</Type>
|
||||
<Code>{{ error_type }}</Code>
|
||||
<Message>{{ message }}</Message>
|
||||
</Error>
|
||||
<RequestId>9dd01905-5012-5f99-8663-4b3ecd0dfaef</RequestId>
|
||||
</ErrorResponse>"""
|
||||
|
||||
|
||||
class SNSNotFoundError(RESTError):
|
||||
code = 404
|
||||
|
||||
def __init__(self, message):
|
||||
super(SNSNotFoundError, self).__init__("NotFound", message)
|
||||
def __init__(self, message, **kwargs):
|
||||
kwargs.setdefault("template", "endpoint_error")
|
||||
kwargs.setdefault("sender", "Sender")
|
||||
self.templates["endpoint_error"] = NOT_FOUND_ENDPOINT_ERROR
|
||||
super(SNSNotFoundError, self).__init__("NotFound", message, **kwargs)
|
||||
|
||||
|
||||
class ResourceNotFoundError(RESTError):
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ class SNSBackend(BaseBackend):
|
|||
try:
|
||||
return self.platform_endpoints[arn]
|
||||
except KeyError:
|
||||
raise SNSNotFoundError("Endpoint with arn {0} not found".format(arn))
|
||||
raise SNSNotFoundError("Endpoint does not exist")
|
||||
|
||||
def set_endpoint_attributes(self, arn, attributes):
|
||||
endpoint = self.get_endpoint(arn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue