Skip to content

Commit

Permalink
Add specific test config and handler for the cloudwatch events
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalvarado committed Sep 4, 2019
1 parent 20f69e2 commit 0e8d9d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions tests/test_event_script_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from __future__ import print_function


def handler_for_events(event, context):
print('Event:', event)
return True
10 changes: 10 additions & 0 deletions tests/test_event_script_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
API_STAGE = 'dev'
APP_FUNCTION = 'handler_for_events'
APP_MODULE = 'tests.test_event_script_app'
DEBUG = 'True'
DJANGO_SETTINGS = None
DOMAIN = 'api.example.com'
ENVIRONMENT_VARIABLES = {}
LOG_LEVEL = 'DEBUG'
PROJECT_NAME = 'test_event_script_app'
COGNITO_TRIGGER_MAPPING = {}
5 changes: 2 additions & 3 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def test_cloudwatch_subscription_event(self):
{ "awslogs": {"data": "BASE64ENCODED_GZIP_COMPRESSED_DATA"} }
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html
"""
lh = LambdaHandler('tests.test_wsgi_script_name_settings')
lh = LambdaHandler('tests.test_event_script_settings')

event = {
'awslogs': {
Expand All @@ -434,5 +434,4 @@ def test_cloudwatch_subscription_event(self):
}
response = lh.handler(event, None)

self.assertEqual(response['statusCode'], 200)
self.assertEqual(response['statusDescription'], '200 OK')
self.assertEqual(response, True)

0 comments on commit 0e8d9d1

Please sign in to comment.