예제 #1
0
    def test_find_usage_acls(self):
        response = result_fixtures.VPC.test_find_usage_acls
        mock_conn = Mock()

        cls = _VpcService(21, 43)
        cls.conn = mock_conn

        mock_conn.describe_network_acls.return_value = response
        cls._find_usage_ACLs()

        usage = sorted(cls.limits['Network ACLs per VPC'].get_current_usage())
        assert len(usage) == 2
        assert usage[0].get_value() == 1
        assert usage[0].resource_id == 'vpc-2'
        assert usage[1].get_value() == 2
        assert usage[1].resource_id == 'vpc-1'
        entries = sorted(cls.limits['Rules per network '
                                    'ACL'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'acl-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'acl-1'
        assert entries[1].get_value() == 3
        assert entries[2].resource_id == 'acl-3'
        assert entries[2].get_value() == 5
        assert mock_conn.mock_calls == [
            call.describe_network_acls()
        ]
예제 #2
0
    def test_find_usage_acls(self):
        response = result_fixtures.VPC.test_find_usage_acls
        mock_conn = Mock()

        cls = _VpcService(21, 43)
        cls.conn = mock_conn

        mock_conn.describe_network_acls.return_value = response
        cls._find_usage_ACLs()

        usage = sorted(cls.limits['Network ACLs per VPC'].get_current_usage())
        assert len(usage) == 2
        assert usage[0].get_value() == 1
        assert usage[0].resource_id == 'vpc-2'
        assert usage[1].get_value() == 2
        assert usage[1].resource_id == 'vpc-1'
        entries = sorted(cls.limits['Rules per network '
                                    'ACL'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'acl-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'acl-1'
        assert entries[1].get_value() == 3
        assert entries[2].resource_id == 'acl-3'
        assert entries[2].get_value() == 5
        assert mock_conn.mock_calls == [
            call.describe_network_acls()
        ]
예제 #3
0
    def test_find_usage_acls(self):
        response = result_fixtures.VPC.test_find_usage_acls
        mock_conn = Mock()

        cls = _VpcService(21, 43, {}, None)
        cls._current_account_id = '0123456789'
        cls.conn = mock_conn

        mock_conn.describe_network_acls.return_value = response
        cls._find_usage_ACLs()

        usage = sorted(cls.limits['Network ACLs per VPC'].get_current_usage())
        assert len(usage) == 2
        assert usage[0].get_value() == 1
        assert usage[0].resource_id == 'vpc-2'
        assert usage[1].get_value() == 2
        assert usage[1].resource_id == 'vpc-1'
        entries = sorted(cls.limits['Rules per network '
                                    'ACL'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'acl-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'acl-1'
        assert entries[1].get_value() == 3
        assert entries[2].resource_id == 'acl-3'
        assert entries[2].get_value() == 5
        assert mock_conn.mock_calls == [
            call.describe_network_acls(Filters=[{
                'Name': 'owner-id',
                'Values': ['0123456789']
            }])
        ]