def test_lambda_has_correct_iam_permissions(self): role_capture = Capture() template.has_resource_properties( 'AWS::IAM::Role', { 'AssumeRolePolicyDocument': Match.object_like({ 'Statement': [{ 'Action': 'sts:AssumeRole', 'Effect': 'Allow', 'Principal': { 'Service': 'lambda.amazonaws.com' }, }], }), 'ManagedPolicyArns': [{ 'Fn::Join': Match.array_with([ ['arn:', { 'Ref': 'AWS::Partition' }, role_capture], ]), }], }) assert 'AWSLambdaBasicExecutionRole' in role_capture.as_string()
def test_event_has_correct_rule(self): template.has_resource_properties( 'AWS::Events::Rule', { 'ScheduleExpression': 'cron(0 18 ? * MON-FRI *)', 'State': 'ENABLED', 'Targets': Match.any_value(), })
def test_lambda_not_running_in_vpc(self): template.has_resource('AWS::Lambda::Function', { 'Vpc': Match.absent() })