def test_link_params(self): pagination = PagedPagination(number=7, size=25) assert pagination.get_link_params(count=157) == { 'first': { 'number': 1, 'size': 25, }, 'last': { 'number': 7, 'size': 25, }, 'prev': { 'number': 6, 'size': 25, }, 'next': None, }
def test_next(self): pagination = PagedPagination(number=2, size=25) assert pagination.get_next() == {'number': 3, 'size': 25}
def test_has_next(self): pagination = PagedPagination(number=6, size=25) assert pagination.has_next(count=157) is True pagination = PagedPagination(number=7, size=25) assert pagination.has_next(count=157) is False
def test_prev(self): pagination = PagedPagination(number=2, size=25) assert pagination.get_prev() == {'number': 1, 'size': 25}
def test_has_prev(self): pagination = PagedPagination(number=1, size=25) assert pagination.has_prev() is False pagination = PagedPagination(number=2, size=25) assert pagination.has_prev() is True
def test_last(self): pagination = PagedPagination(number=2, size=25) assert pagination.get_last(count=157) == {'number': 7, 'size': 25}