Cleanup sns default topic.

This commit is contained in:
Steve Pulec 2017-02-27 10:20:53 -05:00
parent 5a56b3a049
commit a22caf27ab
3 changed files with 6 additions and 5 deletions

View File

@ -26,7 +26,7 @@ class Topic(object):
self.sns_backend = sns_backend self.sns_backend = sns_backend
self.account_id = DEFAULT_ACCOUNT_ID self.account_id = DEFAULT_ACCOUNT_ID
self.display_name = "" self.display_name = ""
self.policy = DEFAULT_TOPIC_POLICY self.policy = json.dumps(DEFAULT_TOPIC_POLICY)
self.delivery_policy = "" self.delivery_policy = ""
self.effective_delivery_policy = DEFAULT_EFFECTIVE_DELIVERY_POLICY self.effective_delivery_policy = DEFAULT_EFFECTIVE_DELIVERY_POLICY
self.arn = make_arn_for_topic( self.arn = make_arn_for_topic(
@ -288,7 +288,7 @@ for region in boto.sns.regions():
sns_backends[region.name] = SNSBackend(region.name) sns_backends[region.name] = SNSBackend(region.name)
DEFAULT_TOPIC_POLICY = json.dumps({ DEFAULT_TOPIC_POLICY = {
"Version": "2008-10-17", "Version": "2008-10-17",
"Id": "us-east-1/698519295917/test__default_policy_ID", "Id": "us-east-1/698519295917/test__default_policy_ID",
"Statement": [{ "Statement": [{
@ -315,7 +315,7 @@ DEFAULT_TOPIC_POLICY = json.dumps({
} }
} }
}] }]
}) }
DEFAULT_EFFECTIVE_DELIVERY_POLICY = json.dumps({ DEFAULT_EFFECTIVE_DELIVERY_POLICY = json.dumps({
'http': { 'http': {

View File

@ -1,5 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import boto import boto
import json
import six import six
import sure # noqa import sure # noqa
@ -75,7 +76,7 @@ def test_topic_attributes():
.format(conn.region.name) .format(conn.region.name)
) )
attributes["Owner"].should.equal(123456789012) 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["DisplayName"].should.equal("")
attributes["SubscriptionsPending"].should.equal(0) attributes["SubscriptionsPending"].should.equal(0)
attributes["SubscriptionsConfirmed"].should.equal(0) attributes["SubscriptionsConfirmed"].should.equal(0)

View File

@ -72,7 +72,7 @@ def test_topic_attributes():
.format(conn._client_config.region_name) .format(conn._client_config.region_name)
) )
attributes["Owner"].should.equal('123456789012') 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["DisplayName"].should.equal("")
attributes["SubscriptionsPending"].should.equal('0') attributes["SubscriptionsPending"].should.equal('0')
attributes["SubscriptionsConfirmed"].should.equal('0') attributes["SubscriptionsConfirmed"].should.equal('0')