Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalvarado committed Sep 4, 2019
1 parent b05c184 commit 20f69e2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,22 @@ def test_merge_headers_no_single_value(self):
self.assertEqual(merged['a'], 'c, d')
self.assertEqual(merged['x'], 'y, z, f')

def test_cloudwatch_subscription_event(self):
"""
Test that events sent in the format used by CloudWatch logs via
subscription filters are handled properly.
The actual payload that Lambda receives is in the following format
{ "awslogs": {"data": "BASE64ENCODED_GZIP_COMPRESSED_DATA"} }
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html
"""
lh = LambdaHandler('tests.test_wsgi_script_name_settings')

event = {
'awslogs': {
'data': "some-data-not-important-for-test"
}
}
response = lh.handler(event, None)

def test_foo(self):
pass
self.assertEqual(response['statusCode'], 200)
self.assertEqual(response['statusDescription'], '200 OK')

0 comments on commit 20f69e2

Please sign in to comment.