From e23edaa47f17d850a69a0461ff2ae31b77f83750 Mon Sep 17 00:00:00 2001 From: Jair Henrique Date: Fri, 6 Mar 2015 14:10:47 -0300 Subject: [PATCH 1/2] add mock for list_endpoints_by_platform_application method --- moto/sns/responses.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/moto/sns/responses.py b/moto/sns/responses.py index 90d338f88..cf500376a 100644 --- a/moto/sns/responses.py +++ b/moto/sns/responses.py @@ -184,3 +184,25 @@ class SNSResponse(BaseResponse): } } }) + + def list_endpoints_by_platform_application(self): + return json.dumps({ + "ListEndpointsByPlatformApplicationResponse": { + "ListEndpointsByPlatformApplicationResult": { + "Endpoints": [ + { + "Attributes": { + "Token": "TOKEN", + "Enabled": "true", + "CustomUserData": "" + }, + "EndpointArn": "FAKE_ARN_ENDPOINT" + } + ], + "NextToken": None + }, + "ResponseMetadata": { + "RequestId": "384ac68d-3775-11df-8963-01868b7c937a", + } + } + }) From bdb0f1e31506b298867dd2ede3c0d0d1f9d2c684 Mon Sep 17 00:00:00 2001 From: Jair Henrique Date: Fri, 6 Mar 2015 14:35:17 -0300 Subject: [PATCH 2/2] add tests for list_endpoints_by_platform_application --- tests/test_sns/test_application.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_sns/test_application.py diff --git a/tests/test_sns/test_application.py b/tests/test_sns/test_application.py new file mode 100644 index 000000000..24c5a1fbd --- /dev/null +++ b/tests/test_sns/test_application.py @@ -0,0 +1,16 @@ +from __future__ import unicode_literals +import boto + +from moto import mock_sns + + +@mock_sns +def test_get_list_endpoints_by_platform_application(): + conn = boto.connect_sns() + endpoint_list = conn.list_endpoints_by_platform_application( + platform_application_arn='fake_arn' + )['ListEndpointsByPlatformApplicationResponse']['ListEndpointsByPlatformApplicationResult']['Endpoints'] + + endpoint_list.should.have.length_of(1) + endpoint_list[0]['Attributes']['Enabled'].should.equal('true') + endpoint_list[0]['EndpointArn'].should.equal('FAKE_ARN_ENDPOINT')