Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_nofails_funcs(self):
funk = import_and_get_task("tests.test_app.async_me")
get_func_task_path(funk)
self.assertEqual(funk.__name__, 'async_me')
# AWS Lambda
options = {
'AWS_LAMBDA_FUNCTION_NAME': 'MyLambda',
'AWS_REGION': 'us-east-1'
}
with mock.patch.dict(os.environ, options):
self.assertEqual(async_me("qux"),
"Running async!")
# And check the dispatching class got called correctly
lambda_async_mock.assert_called_once()
lambda_async_mock.assert_called_with(aws_region='us-east-1',
capture_response=False,
lambda_function_name="MyLambda")
lambda_async_mock.return_value.send.assert_called_with(
get_func_task_path(async_me), ("qux",), {})