Esempio n. 1
0
def test_all_resources_with_oversized_event(config, context):
    fail_all_resources.handler(OVERSIZED_EVENT, context)
    config.put_evaluations.assert_called_with(Evaluations=[{
        'ComplianceResourceType':
        'AWS::EC2::Instance',
        'ComplianceResourceId':
        'i-00000000',
        'ComplianceType':
        'NON_COMPLIANT',
        'Annotation':
        'No Resources should be deployed in this Region',
        'OrderingTimestamp':
        '2016-10-06T16:46:16.261Z'
    }],
                                              ResultToken='myResultToken')
Esempio n. 2
0
def test_all_resources_with_event(config, context):
    fail_all_resources.handler(EVENT, context)
    config.put_evaluations.assert_called_with(Evaluations=[{
        'ComplianceResourceType':
        'AWS::EC2::Instance',
        'ComplianceResourceId':
        'i-00000000',
        'ComplianceType':
        'NON_COMPLIANT',
        'Annotation':
        'No Resources should be deployed in this Region',
        'OrderingTimestamp':
        '2016-02-17T01:36:34.043Z'
    }],
                                              ResultToken='myResultToken')
Esempio n. 3
0
def test_ignores_audit_stack_set(config, mocker, context):
    fail_all_resources.handler(AUDIT_STACK_SET_EVENT, context)
    config.put_evaluations.assert_called_with(Evaluations=[{
        'ComplianceResourceType':
        'AWS::CloudFormation::Stack',
        'ComplianceResourceId':
        'StackSet-audit-test-something',
        'ComplianceType':
        'COMPLIANT',
        'Annotation':
        'Compliant',
        'OrderingTimestamp':
        '2016-02-17T01:36:34.043Z'
    }],
                                              ResultToken='myResultToken')
Esempio n. 4
0
def test_ignores_lambda(config, mocker, context):
    fail_all_resources.handler(LAMBDA_FUNCTION_EVENT, context)
    config.put_evaluations.assert_called_with(Evaluations=[{
        'ComplianceResourceType':
        'AWS::Lambda::Function',
        'ComplianceResourceId':
        LAMBDA_FUNCTION,
        'ComplianceType':
        'COMPLIANT',
        'Annotation':
        'Compliant',
        'OrderingTimestamp':
        '2016-02-17T01:36:34.043Z'
    }],
                                              ResultToken='myResultToken')
Esempio n. 5
0
def test_config_stack_is_compliant(config, mocker, context):
    fail_all_resources.handler(STACK_EVENT, context)
    config.put_evaluations.assert_called_with(Evaluations=[{
        'ComplianceResourceType':
        'AWS::CloudFormation::Stack',
        'ComplianceResourceId':
        'TestStack',
        'ComplianceType':
        'COMPLIANT',
        'Annotation':
        'Compliant',
        'OrderingTimestamp':
        '2016-02-17T01:36:34.043Z'
    }],
                                              ResultToken='myResultToken')