Пример #1
0
    def test_find_usage_route_tables(self):
        response = result_fixtures.VPC.test_find_usage_route_tables

        mock_conn = Mock()
        mock_conn.describe_route_tables.return_value = response

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

        cls._find_usage_route_tables()

        usage = sorted(cls.limits['Route tables 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['Entries per route '
                                    'table'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'rt-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'rt-1'
        assert entries[1].get_value() == 2
        assert entries[2].resource_id == 'rt-3'
        assert entries[2].get_value() == 3
        assert mock_conn.mock_calls == [
            call.describe_route_tables()
        ]
Пример #2
0
    def test_find_usage_route_tables(self):
        response = result_fixtures.VPC.test_find_usage_route_tables

        mock_conn = Mock()
        mock_conn.describe_route_tables.return_value = response

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

        cls._find_usage_route_tables()

        usage = sorted(cls.limits['Route tables 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['Entries per route '
                                    'table'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'rt-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'rt-1'
        assert entries[1].get_value() == 3
        assert entries[2].resource_id == 'rt-3'
        assert entries[2].get_value() == 5
        assert mock_conn.mock_calls == [
            call.describe_route_tables()
        ]
Пример #3
0
    def test_find_usage_route_tables(self):
        response = result_fixtures.VPC.test_find_usage_route_tables

        mock_conn = Mock()
        mock_conn.describe_route_tables.return_value = response

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

        cls._find_usage_route_tables()

        usage = sorted(cls.limits['Route tables 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['Entries per route '
                                    'table'].get_current_usage())
        assert len(entries) == 3
        assert entries[0].resource_id == 'rt-2'
        assert entries[0].get_value() == 1
        assert entries[1].resource_id == 'rt-1'
        assert entries[1].get_value() == 2
        assert entries[2].resource_id == 'rt-3'
        assert entries[2].get_value() == 3
        assert mock_conn.mock_calls == [
            call.describe_route_tables(Filters=[{
                'Name': 'owner-id',
                'Values': ['0123456789']
            }])
        ]