Skip to content

Commit

Permalink
Add test for async sns event
Browse files Browse the repository at this point in the history
  • Loading branch information
cscetbon committed Jun 4, 2017
1 parent 5c0a9b3 commit a7087fa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def aws_s3_event(event, content):
def aws_sns_event(event, content):
return "AWS SNS EVENT"

def aws_async_sns_event(arg1, arg2, arg3):
return "AWS ASYNC SNS EVENT"


def aws_dynamodb_event(event, content):
return "AWS DYNAMODB EVENT"
Expand Down
31 changes: 31 additions & 0 deletions tests/tests_placebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,37 @@ def test_handler(self, session):
}
self.assertEqual("AWS SNS EVENT", lh.handler(event, None))

# Test AWS SNS event
event = {
u'account': u'72333333333',
u'region': u'us-east-1',
u'detail': {},
u'Records': [
{
u'EventVersion': u'1.0',
u'EventSource': u'aws:sns',
u'EventSubscriptionArn': u'arn:aws:sns:EXAMPLE',
u'Sns': {
u'SignatureVersion': u'1',
u'Timestamp': u'1970-01-01T00:00:00.000Z',
u'Signature': u'EXAMPLE',
u'SigningCertUrl': u'EXAMPLE',
u'MessageId': u'95df01b4-ee98-5cb9-9903-4c221d41eb5e',
u'Message': u'{"args": ["arg1", "arg2"], "command": "zappa.async.route_sns_task", '
u'"task_path": "test_settings.aws_async_sns_event", "kwargs": {"arg3": "varg3"}}',
u'Subject': u'TestInvoke',
u'Type': u'Notification',
u'UnsubscribeUrl': u'EXAMPLE',
u'MessageAttributes': {
u'Test': {u'Type': u'String', u'Value': u'TestString'},
u'TestBinary': {u'Type': u'Binary', u'Value': u'TestBinary'}
}
}
}
]
}
self.assertEqual("AWS ASYNC SNS EVENT", lh.handler(event, None))

# Test AWS DynamoDB event
event = {
u'Records': [
Expand Down

0 comments on commit a7087fa

Please sign in to comment.