def test_empty_page(self): pets, _ = paginate_pets(Pet.objects.all(), 42) self.assertEqual(1, len(pets)) self.assertEqual('First Kind', pets[0].kind.kind)
def test_page_not_integer(self): pets, _ = paginate_pets(Pet.objects.all(), 'page') self.assertEqual(1, len(pets)) self.assertEqual('First Kind', pets[0].kind.kind)
def test_empty_page(self): """If the user inform an empty page we should present the last page with data""" pets, _ = paginate_pets(Pet.objects.all(), 42) self.assertEqual(1, len(pets)) self.assertEqual('First Kind', pets[0].kind.kind)
def test_page_not_integer(self): """In case of a non-integer page, i.e, incorrent url, we should show the first page""" pets, _ = paginate_pets(Pet.objects.all(), 'page') self.assertEqual(1, len(pets)) self.assertEqual('First Kind', pets[0].kind.kind)