Example #1
0
 def test_lambda_handler__logger_level(self, logger_set_level, client_mock):
     global_vars = LambdaGlobals()
     lambda_handler = get_lambda_handler(self.Child, global_vars,
                                         self.TEST_CONFIG)
     event = {'k': 'm', 'logging_level': 20}
     lambda_handler(event=event, context={'context': 'test'})
     logger_set_level.assert_called_once_with(20)
Example #2
0
    def test_lambda_handler(self):

        global_vars = LambdaGlobals()
        self.assertIsNone(global_vars.processor)
        self.assertIsNone(global_vars.lambda_context)

        lambda_handler = get_lambda_handler(self.Child, global_vars,
                                            self.TEST_CONFIG)
        self.assertIsNotNone(lambda_handler)

        for i in range(3):
            result = lambda_handler(event={'k': 'success'},
                                    context={'context': 'test'})
            self.assertEqual(type(global_vars.processor), self.Child)
            self.assertEqual(global_vars.lambda_context, {'context': 'test'})
            self.assertEqual(result, 'success')
            self.assertEqual(
                global_vars.processor.stats['total_processor_calls'], i + 1)
            self.assertEqual(
                global_vars.processor.stats['total_calls_register_clients'], 1)
Example #3
0
"""Sosw Essential Scavenger
"""

import logging

from sosw.scavenger import Scavenger
from sosw.app import LambdaGlobals, get_lambda_handler

logger = logging.getLogger()
logger.setLevel(logging.INFO)


class Essential(Scavenger):
    pass


global_vars = LambdaGlobals()
lambda_handler = get_lambda_handler(Essential, global_vars)