Example #1
0
    def test_redis_listing_handler_used_from_view_when_requested(self):
        ct_id = self.publishables[0].content_type_id
        t1, t2 = time.time() - 90, time.time() - 100
        redis.client.zadd('listing:d:2', '%d:1' % ct_id, repr(t1))
        redis.client.zadd('listing:d:2', '%d:3' % ct_id, repr(t2))
        dt1, dt2 = from_timestamp(t1), from_timestamp(t2)

        rf = RequestFactory()
        request = rf.get(self.category_nested.get_absolute_url(),
                         {'using': 'redis'})
        lct = ListContentType()

        context = lct.get_context(request, self.category_nested)
        tools.assert_equals(2, len(context['listings']))
        l1, l2 = context['listings']

        tools.assert_equals(l1.publishable, self.publishables[0])
        tools.assert_equals(l2.publishable, self.publishables[2])
        tools.assert_equals(l1.publish_from, dt1)
        tools.assert_equals(l2.publish_from, dt2)
Example #2
0
 def setUp(self):
     super(TestCategoryDetail, self).setUp()
     self.category_detail = ListContentType()
Example #3
0
 def setUp(self):
     super(TestListContentType, self).setUp()
     create_and_place_more_publishables(self)
     list_all_placements_in_category_by_hour(self, category=self.category)
     self.list_content_type = ListContentType()