sns#create_platform_endpoint: If token and attributes are the same, return endpoint (#4055)

* If token and attributes are the same, return endpoint

* fix black

* moto sns platform_endpoint.attributes includes only token,enabled

* add tests when calling sns#create_platform_endpoint with same attrs for #4056
This commit is contained in:
kohbis 2021-07-04 15:43:22 +09:00 committed by GitHub
commit c20a36b8cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 5 deletions

View file

@ -156,10 +156,37 @@ def test_create_duplicate_platform_endpoint():
PlatformApplicationArn=application_arn,
Token="some_unique_id",
CustomUserData="some user data",
Attributes={"Enabled": "false"},
Attributes={"Enabled": "true"},
).should.throw(ClientError)
@mock_sns
def test_create_duplicate_platform_endpoint_with_same_attributes():
conn = boto3.client("sns", region_name="us-east-1")
platform_application = conn.create_platform_application(
Name="my-application", Platform="APNS", Attributes={}
)
application_arn = platform_application["PlatformApplicationArn"]
created_endpoint = conn.create_platform_endpoint(
PlatformApplicationArn=application_arn,
Token="some_unique_id",
CustomUserData="some user data",
Attributes={"Enabled": "false"},
)
created_endpoint_arn = created_endpoint["EndpointArn"]
endpoint = conn.create_platform_endpoint(
PlatformApplicationArn=application_arn,
Token="some_unique_id",
CustomUserData="some user data",
Attributes={"Enabled": "false"},
)
endpoint_arn = endpoint["EndpointArn"]
endpoint_arn.should.equal(created_endpoint_arn)
@mock_sns
def test_get_list_endpoints_by_platform_application():
conn = boto3.client("sns", region_name="us-east-1")