Skip to content

Commit

Permalink
SNS: delete_endpoint() is now an idempotent operation, just like AWS (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bblommers committed Mar 26, 2024
1 parent e4ec1a4 commit 1fc2200
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion moto/sns/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def delete_endpoint(self, arn: str) -> None:
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)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_sns/test_application_boto3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1fc2200

Please sign in to comment.