def test_paginate_custom_size(self, user_factory, config, mocker): mocker.patch('bip.utils.pagination.get_page', mocker.Mock(return_value=1)) config['LIST_SIZE'] = 3 user_factory.create_batch(10, password='******') query = User.select() rv = paginate(query, size=20) assert rv.has_next is False assert rv.has_prev is False
def test_paginate_defaults_middle_pages(self, page, user_factory, config, mocker): mocker.patch('bip.utils.pagination.get_page', mocker.Mock(return_value=page)) config['LIST_SIZE'] = 3 user_factory.create_batch(10, password='******') query = User.select() rv = paginate(query) assert rv.has_next is True assert rv.has_prev is True assert rv.per_page == config['LIST_SIZE']