Enabled SNS endpoint attr must be lowercased (#3543)
As per sample response: https://docs.aws.amazon.com/sns/latest/api/API_GetEndpointAttributes.html
This commit is contained in:
parent
54bd336457
commit
c9c30b8286
@ -331,8 +331,11 @@ class PlatformEndpoint(BaseModel):
|
|||||||
# automatically ensure they exist as well.
|
# automatically ensure they exist as well.
|
||||||
if "Token" not in self.attributes:
|
if "Token" not in self.attributes:
|
||||||
self.attributes["Token"] = self.token
|
self.attributes["Token"] = self.token
|
||||||
if "Enabled" not in self.attributes:
|
if "Enabled" in self.attributes:
|
||||||
self.attributes["Enabled"] = "True"
|
enabled = self.attributes["Enabled"]
|
||||||
|
self.attributes["Enabled"] = enabled.lower()
|
||||||
|
else:
|
||||||
|
self.attributes["Enabled"] = "true"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def enabled(self):
|
def enabled(self):
|
||||||
@ -594,6 +597,8 @@ class SNSBackend(BaseBackend):
|
|||||||
|
|
||||||
def set_endpoint_attributes(self, arn, attributes):
|
def set_endpoint_attributes(self, arn, attributes):
|
||||||
endpoint = self.get_endpoint(arn)
|
endpoint = self.get_endpoint(arn)
|
||||||
|
if "Enabled" in attributes:
|
||||||
|
attributes["Enabled"] = attributes["Enabled"].lower()
|
||||||
endpoint.attributes.update(attributes)
|
endpoint.attributes.update(attributes)
|
||||||
return endpoint
|
return endpoint
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ def test_get_endpoint_attributes():
|
|||||||
platform_application_arn=application_arn,
|
platform_application_arn=application_arn,
|
||||||
token="some_unique_id",
|
token="some_unique_id",
|
||||||
custom_user_data="some user data",
|
custom_user_data="some user data",
|
||||||
attributes={"Enabled": False, "CustomUserData": "some data"},
|
attributes={"CustomUserData": "some data"},
|
||||||
)
|
)
|
||||||
endpoint_arn = endpoint["CreatePlatformEndpointResponse"][
|
endpoint_arn = endpoint["CreatePlatformEndpointResponse"][
|
||||||
"CreatePlatformEndpointResult"
|
"CreatePlatformEndpointResult"
|
||||||
@ -199,7 +199,7 @@ def test_get_endpoint_attributes():
|
|||||||
"GetEndpointAttributesResponse"
|
"GetEndpointAttributesResponse"
|
||||||
]["GetEndpointAttributesResult"]["Attributes"]
|
]["GetEndpointAttributesResult"]["Attributes"]
|
||||||
attributes.should.equal(
|
attributes.should.equal(
|
||||||
{"Token": "some_unique_id", "Enabled": "False", "CustomUserData": "some data"}
|
{"Token": "some_unique_id", "Enabled": "true", "CustomUserData": "some data"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ def test_set_endpoint_attributes():
|
|||||||
"GetEndpointAttributesResponse"
|
"GetEndpointAttributesResponse"
|
||||||
]["GetEndpointAttributesResult"]["Attributes"]
|
]["GetEndpointAttributesResult"]["Attributes"]
|
||||||
attributes.should.equal(
|
attributes.should.equal(
|
||||||
{"Token": "some_unique_id", "Enabled": "False", "CustomUserData": "other data"}
|
{"Token": "some_unique_id", "Enabled": "false", "CustomUserData": "other data"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user