SNS: delete_endpoint() is now an idempotent operation, just like AWS (#7524)

This commit is contained in:
Bert Blommers 2024-03-26 20:06:29 -01:00 committed by GitHub
parent e4ec1a40ed
commit 1fc22000d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -715,7 +715,7 @@ class SNSBackend(BaseBackend):
try:
del self.platform_endpoints[arn]
except KeyError:
raise SNSNotFoundError(f"Endpoint with arn {arn} not found")
pass # idempotent operation
def get_subscription_attributes(self, arn: str) -> Dict[str, Any]:
subscription = self.subscriptions.get(arn)

View File

@ -266,6 +266,13 @@ def test_get_list_endpoints_by_platform_application(api_key=None):
assert len(endpoint_list) == 1
assert endpoint_list[0]["Attributes"]["CustomUserData"] == "some data"
assert endpoint_list[0]["EndpointArn"] == endpoint_arn
resp = conn.delete_endpoint(EndpointArn=endpoint_arn)
assert resp["ResponseMetadata"]["HTTPStatusCode"] == 200
# Idempotent operation
resp = conn.delete_endpoint(EndpointArn=endpoint_arn)
assert resp["ResponseMetadata"]["HTTPStatusCode"] == 200
finally:
if application_arn is not None:
conn.delete_platform_application(PlatformApplicationArn=application_arn)