def test_reflect_priorities(self): l = self.listings[-1] l.priority_value = 10 l.priority_from = datetime.now() - timedelta(days=1) l.priority_to = datetime.now() + timedelta(days=1) l.save() c = _list_content_type('', '2008') expected = [l] + self.listings[:-1] self.assert_equals(expected, c['listings'])
def test_returns_empty_list_if_no_listing_found(self): c = _list_content_type('', '2007') self.assert_equals([], c['listings'])
def test_return_second_2_listings_if_paginate_by_2_and_page_2(self): c = _list_content_type('', '2008', page_no=2, paginate_by=2) self.assert_equals(self.listings[2:4], c['listings']) self.assert_true(c['is_paginated'])
def test_return_first_2_listings_if_paginate_by_2(self): c = _list_content_type('', '2008', paginate_by=2) self.assert_equals(self.listings[:2], c['listings']) self.assert_true(c['is_paginated'])
def test_only_nested_category_and_year_returns_all_listings(self): Listing.objects.all().update(category=self.category_nested_second) c = _list_content_type('nested-category/second-nested-category', '2008') self.assert_equals(self.listings, c['listings'])
def test_only_category_and_year_returns_all_listings(self): c = _list_content_type('', '2008') self.assert_equals(self.listings, c['listings'])