From a22caf27ab698eb13da0f030dc67b108cd9b47ef Mon Sep 17 00:00:00 2001 From: Steve Pulec Date: Mon, 27 Feb 2017 10:20:53 -0500 Subject: [PATCH] Cleanup sns default topic. --- moto/sns/models.py | 6 +++--- tests/test_sns/test_topics.py | 3 ++- tests/test_sns/test_topics_boto3.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/moto/sns/models.py b/moto/sns/models.py index 0ad00928d..4fa72a7d0 100644 --- a/moto/sns/models.py +++ b/moto/sns/models.py @@ -26,7 +26,7 @@ class Topic(object): self.sns_backend = sns_backend self.account_id = DEFAULT_ACCOUNT_ID self.display_name = "" - self.policy = DEFAULT_TOPIC_POLICY + self.policy = json.dumps(DEFAULT_TOPIC_POLICY) self.delivery_policy = "" self.effective_delivery_policy = DEFAULT_EFFECTIVE_DELIVERY_POLICY self.arn = make_arn_for_topic( @@ -288,7 +288,7 @@ for region in boto.sns.regions(): sns_backends[region.name] = SNSBackend(region.name) -DEFAULT_TOPIC_POLICY = json.dumps({ +DEFAULT_TOPIC_POLICY = { "Version": "2008-10-17", "Id": "us-east-1/698519295917/test__default_policy_ID", "Statement": [{ @@ -315,7 +315,7 @@ DEFAULT_TOPIC_POLICY = json.dumps({ } } }] -}) +} DEFAULT_EFFECTIVE_DELIVERY_POLICY = json.dumps({ 'http': { diff --git a/tests/test_sns/test_topics.py b/tests/test_sns/test_topics.py index 79b85f709..cbb4849c8 100644 --- a/tests/test_sns/test_topics.py +++ b/tests/test_sns/test_topics.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals import boto +import json import six import sure # noqa @@ -75,7 +76,7 @@ def test_topic_attributes(): .format(conn.region.name) ) attributes["Owner"].should.equal(123456789012) - attributes["Policy"].should.equal(DEFAULT_TOPIC_POLICY) + json.loads(attributes["Policy"]).should.equal(DEFAULT_TOPIC_POLICY) attributes["DisplayName"].should.equal("") attributes["SubscriptionsPending"].should.equal(0) attributes["SubscriptionsConfirmed"].should.equal(0) diff --git a/tests/test_sns/test_topics_boto3.py b/tests/test_sns/test_topics_boto3.py index 55d03afff..bfa9b5d1f 100644 --- a/tests/test_sns/test_topics_boto3.py +++ b/tests/test_sns/test_topics_boto3.py @@ -72,7 +72,7 @@ def test_topic_attributes(): .format(conn._client_config.region_name) ) attributes["Owner"].should.equal('123456789012') - attributes["Policy"].should.equal(DEFAULT_TOPIC_POLICY) + json.loads(attributes["Policy"]).should.equal(DEFAULT_TOPIC_POLICY) attributes["DisplayName"].should.equal("") attributes["SubscriptionsPending"].should.equal('0') attributes["SubscriptionsConfirmed"].should.equal('0')