GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 73c5c0...bade8b )
by Drew J.
43s
created

ConfigRuleTests.test_unimplemented_callbacks()   A

Complexity

Conditions 3

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 3
c 3
b 0
f 0
dl 0
loc 10
rs 9.4285
1
# -*- coding: utf-8 -*-
2
import unittest
3
from mock import MagicMock
4
from awslambdahelper import AWSConfigRule
5
6
7
class ConfigRuleTests(unittest.TestCase):
8
    def test_classinstantiation(self):
9
        AWSConfigRule(
10
            applicable_resources=["AWS::EC2::INSTANCE"]
11
        )
12
13
    def test_configcalltype(self):
14
        rule = AWSConfigRule(
15
            applicable_resources=["AWS::EC2::INSTANCE"]
16
        )
17
        rule.call_type = AWSConfigRule.CALL_TYPE_CONFIGURATION_CHANGE
18
19
        self.assertTrue(rule.is_config_change_call)
20
21
    def test_schedulecalltype(self):
22
        rule = AWSConfigRule(
23
            applicable_resources=["AWS::EC2::INSTANCE"]
24
        )
25
        rule.call_type = AWSConfigRule.CALL_TYPE_SCHEDULED
26
27
        self.assertTrue(rule.is_scheduled_call)
28
29
    def test_unimplemented_callbacks(self):
30
        rule = AWSConfigRule(
31
            applicable_resources=["AWS::EC2::INSTANCE"]
32
        )
33
34
        with self.assertRaises(NotImplementedError):
35
            rule.find_violation_config_change(config=None, rule_parameters=None)
36
37
        with self.assertRaises(NotImplementedError):
38
            rule.find_violation_scheduled(rule_parameters=None, accountid=None)
39
40
    def test_statichandler(self):
41
        class MockHandler(AWSConfigRule):
42
            APPLICABLE_RESOURCES = ['a', 'b']
43
44
        MockHandler.lambda_handler = MagicMock()
45
46
        MockHandler.handler({'event': None}, {'context': None})
47
48
        MockHandler.lambda_handler.assert_called_once_with(
49
            {'event': None}, {'context': None}
50
        )
51
52
    def test__aws_call(self):
53
        callable_payload = lambda: 'TestResponse'
54
55
        rule = AWSConfigRule()
56
        self.assertEqual(
57
            rule._aws_call(callable_payload),
58
            'TestResponse'
59
        )