#NEWLINE# @ mock_cloudformation #NEWLINE# @ mock_lambda #NEWLINE# def test_lambda_function( ) : #NEWLINE# #INDENT# conn = boto3 . client ( 'lambda' , 'us-east-1' ) #NEWLINE# template = { #NEWLINE# #INDENT# 'AWSTemplateFormatVersion' : '2010-09-09' , #NEWLINE# 'Resources' : { #NEWLINE# #INDENT# 'lambdaTest' : { #NEWLINE# #INDENT# 'Type' : 'AWS::Lambda::Function' , #NEWLINE# 'Properties' : { #NEWLINE# #INDENT# 'Code' : { #NEWLINE# #INDENT# 'ZipFile' : { #NEWLINE# #INDENT# 'Fn::Join' : [ '\n' , '\n                            exports.handler = function(event, context) {\n                                context.succeed();\n                            }\n                            ' . splitlines ( ) ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# 'Handler' : 'index.handler' , #NEWLINE# 'Description' : 'Test function' , #NEWLINE# 'MemorySize' : 128 , #NEWLINE# 'Role' : 'test-role' , #NEWLINE# 'Runtime' : 'nodejs' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# template_json = json . dumps ( template ) #NEWLINE# cf_conn = boto . cloudformation . connect_to_region ( 'us-east-1' ) #NEWLINE# cf_conn . create_stack ( 'test_stack' , template_body = template_json ) #NEWLINE# result = conn . list_functions ( ) #NEWLINE# result [ 'Functions' ] . should . have . length_of ( 1 ) #NEWLINE# result [ 'Functions' ] [ 0 ] [ 'Description' ] . should . equal ( 'Test function' ) #NEWLINE# result [ 'Functions' ] [ 0 ] [ 'Handler' ] . should . equal ( 'index.handler' ) #NEWLINE# result [ 'Functions' ] [ 0 ] [ 'MemorySize' ] . should . equal ( 128 ) #NEWLINE# result [ 'Functions' ] [ 0 ] [ 'Role' ] . should . equal ( 'test-role' ) #NEWLINE# result [ 'Functions' ] [ 0 ] [ 'Runtime' ] . should . equal ( 'nodejs' )