• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python test_core.list_all_publishables_in_category_by_hour函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_ella.test_core.list_all_publishables_in_category_by_hour函数的典型用法代码示例。如果您正苦于以下问题:Python list_all_publishables_in_category_by_hour函数的具体用法?Python list_all_publishables_in_category_by_hour怎么用?Python list_all_publishables_in_category_by_hour使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了list_all_publishables_in_category_by_hour函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_listing_save_adds_itself_to_relevant_zsets

    def test_listing_save_adds_itself_to_relevant_zsets(self):
        list_all_publishables_in_category_by_hour(self)
        ct_id = self.publishables[0].content_type_id
        tools.assert_equals(set([
            'listing:1',
            'listing:2',
            'listing:3',

            'listing:c:1',
            'listing:c:2',
            'listing:c:3',

            'listing:d:1',
            'listing:d:2',
            'listing:d:3',

            'listing:a:%d' % self.author.pk,

            'listing:ct:%d' % ct_id,

            ]),
            set(self.redis.keys())
        )
        tools.assert_equals(['%d:1' % ct_id, '%d:2' % ct_id, '%d:3' % ct_id],
                            self.redis.zrange('listing:a:1', 0, 100))
开发者ID:MikeLing,项目名称:ella,代码行数:25,代码来源:test_cache.py


示例2: test_listing_gets_removed_when_publishable_goes_unpublished

    def test_listing_gets_removed_when_publishable_goes_unpublished(self):
        list_all_publishables_in_category_by_hour(self)
        p = self.publishables[0]
        p.published = False
        p.save()
        ct_id = p.content_type_id
        tools.assert_equals(set([
                'listing:2',
                'listing:3',

                'listing:c:1',
                'listing:c:2',
                'listing:c:3',

                'listing:d:1',
                'listing:d:2',
                'listing:d:3',

                'listing:ct:%d' % ct_id,
            ]),
            set(self.redis.keys())
        )
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:ct:%d' % ct_id, 0, 100))
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:d:1', 0, 100))
        tools.assert_equals(['%d:2' % ct_id], self.redis.zrange('listing:c:1', 0, 100))
开发者ID:MikeLing,项目名称:ella,代码行数:25,代码来源:test_cache.py


示例3: test_listing_delete_removes_itself_from_redis

    def test_listing_delete_removes_itself_from_redis(self):
        list_all_publishables_in_category_by_hour(self)
        self.listings[1].delete()
        ct_id = self.publishables[0].content_type_id
        tools.assert_equals(set([
                'listing:1',
                'listing:3',

                'listing:c:1',
                'listing:c:2',
                'listing:c:3',

                'listing:d:1',
                'listing:d:2',
                'listing:d:3',

                'listing:ct:%d' % ct_id,
            ]),
            set(self.redis.keys())
        )
        tools.assert_equals(['%d:3' % ct_id], self.redis.zrange('listing:3', 0, 100))
        tools.assert_equals(['%d:3' % ct_id], self.redis.zrange('listing:c:2', 0, 100))
        tools.assert_equals(['%d:3' % ct_id], self.redis.zrange('listing:d:2', 0, 100))
        tools.assert_equals(['%d:1' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:d:1', 0, 100))
        tools.assert_equals(['%d:1' % ct_id], self.redis.zrange('listing:c:1', 0, 100))
        tools.assert_equals(['%d:1' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:ct:%d' % ct_id, 0, 100))
开发者ID:MikeLing,项目名称:ella,代码行数:26,代码来源:test_cache.py


示例4: test_listing_gets_removed_when_publishable_marked_unpublished_even_if_not_published_yet

    def test_listing_gets_removed_when_publishable_marked_unpublished_even_if_not_published_yet(self):
        future = now() + timedelta(days=1)

        p = self.publishables[0]
        p.publish_from = future
        p.save()

        list_all_publishables_in_category_by_hour(self)
        p.published = False
        p.save()
        ct_id = p.content_type_id
        tools.assert_equals(set([
                'listing:2',
                'listing:3',

                'listing:c:1',
                'listing:c:2',
                'listing:c:3',

                'listing:d:1',
                'listing:d:2',
                'listing:d:3',

                'listing:ct:%d' % ct_id,
            ]),
            set(redis.client.keys())
        )
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], redis.client.zrange('listing:ct:%d' % ct_id, 0, 100))
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], redis.client.zrange('listing:d:1', 0, 100))
        tools.assert_equals(['%d:2' % ct_id], redis.client.zrange('listing:c:1', 0, 100))
开发者ID:MichalMaM,项目名称:ella,代码行数:30,代码来源:test_cache.py


示例5: test_listing_save_adds_itself_to_relevant_zsets

 def test_listing_save_adds_itself_to_relevant_zsets(self):
     list_all_publishables_in_category_by_hour(self)
     ct_id = self.publishables[0].content_type_id
     tools.assert_equals(
         set(
             [
                 "listing:1",
                 "listing:2",
                 "listing:3",
                 "listing:c:1",
                 "listing:c:2",
                 "listing:c:3",
                 "listing:d:1",
                 "listing:d:2",
                 "listing:d:3",
                 "listing:ct:%d" % ct_id,
             ]
         ),
         set(self.redis.keys()),
     )
     tools.assert_equals(["%d:3" % ct_id], self.redis.zrange("listing:3", 0, 100))
     tools.assert_equals(
         ["%d:1" % ct_id, "%d:2" % ct_id, "%d:3" % ct_id], self.redis.zrange("listing:ct:%d" % ct_id, 0, 100)
     )
     tools.assert_equals(["%d:1" % ct_id, "%d:2" % ct_id, "%d:3" % ct_id], self.redis.zrange("listing:d:1", 0, 100))
开发者ID:horakz,项目名称:ella,代码行数:25,代码来源:test_cache.py


示例6: setUp

    def setUp(self):
        super(GetRelatedTestCase, self).setUp()
        create_basic_categories(self)
        create_and_place_a_publishable(self)
        create_and_place_more_publishables(self)

        Publishable.objects.all().update(category=self.publishable.category)

        list_all_publishables_in_category_by_hour(self, category=self.publishable.category)
开发者ID:MichalMaM,项目名称:ella,代码行数:9,代码来源:test_related.py


示例7: test_time_based_lh_slicing

    def test_time_based_lh_slicing(self):
        list_all_publishables_in_category_by_hour(self)
        # Instantiate the RedisListingHandler and have it fetch all children
        lh = redis.TimeBasedListingHandler(self.category, ListingHandler.ALL)

        for offset, count in [(0, 10), (0, 1), (0, 2), (1, 2), (2, 3), (3, 3)]:
            partial = lh.get_listings(offset=offset, count=count)
            tools.assert_equals(
                [l.publishable for l in partial],
                [l.publishable for l in self.listings[offset:offset + count]]
            )
开发者ID:MichalMaM,项目名称:ella,代码行数:11,代码来源:test_cache.py


示例8: test_author_view

    def test_author_view(self):
        author = Author.objects.create(slug='some-author')
        create_and_place_more_publishables(self)
        for p in self.publishables:
            p.authors.add(author)
        list_all_publishables_in_category_by_hour(self)

        template_loader.templates['page/author.html'] = 'page/category.html'
        response = self.client.get(author.get_absolute_url())
        tools.assert_true('listings' in response.context)
        tools.assert_equals(set(p.pk for p in self.publishables), set(l.publishable.pk for l in response.context['listings']))
开发者ID:jccode2,项目名称:ella,代码行数:11,代码来源:test_views.py


示例9: test_gets_removed_when_last_listing_is_deleted

    def test_gets_removed_when_last_listing_is_deleted(self):
        list_all_publishables_in_category_by_hour(self)
        ct_id = self.publishables[0].content_type_id

        while 1:
            listings = self.publishables[0].listing_set.all()

            if len(listings):
                tools.ok_('%d:1' % ct_id in redis.client.zrange('listing:a:1', 0, 100))
                listings[0].delete()
            else:
                tools.ok_('%d:1' % ct_id not in redis.client.zrange('listing:a:1', 0, 100))
                break
开发者ID:MichalMaM,项目名称:ella,代码行数:13,代码来源:test_cache.py


示例10: setUp

    def setUp(self):
        try:
            import feedparser
        except ImportError:
            raise SkipTest()

        super(TestFeeds, self).setUp()
        create_basic_categories(self)
        create_and_place_more_publishables(self)
        list_all_publishables_in_category_by_hour(self)


        self._feeder = RSSTopCategoryListings()
开发者ID:cooncesean,项目名称:ella,代码行数:13,代码来源:test_feeds.py


示例11: test_listings_dont_propagate_where_they_shouldnt

    def test_listings_dont_propagate_where_they_shouldnt(self):
        self.category_nested.app_data = {'ella': {'propagate_listings': False}}
        self.category_nested.save()

        # small hack to remove the cached category on Publishable
        for p in self.publishables:
            del p._category_cache

        list_all_publishables_in_category_by_hour(self)
        ct_id = self.publishables[0].content_type_id
        tools.assert_equals(['%d:1' % ct_id], self.redis.zrange('listing:d:1', 0, 100))
        tools.assert_equals(['%d:1' % ct_id], self.redis.zrange('listing:c:1', 0, 100))
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:c:2', 0, 100))
        tools.assert_equals(['%d:2' % ct_id, '%d:3' % ct_id], self.redis.zrange('listing:d:2', 0, 100))
开发者ID:MikeLing,项目名称:ella,代码行数:14,代码来源:test_cache.py


示例12: test_not_added_when_not_published

    def test_not_added_when_not_published(self):
        ct_id = self.publishables[0].content_type_id

        self.publishables[0].published = False
        self.publishables[0].save()

        list_all_publishables_in_category_by_hour(self)

        tools.ok_('%d:1' % ct_id not in redis.client.zrange('listing:a:1', 0, 100))

        self.publishables[0].published = True
        self.publishables[0].save()

        tools.ok_('%d:1' % ct_id in redis.client.zrange('listing:a:1', 0, 100))

        self.publishables[0].published = False
        self.publishables[0].save()

        tools.ok_('%d:1' % ct_id not in redis.client.zrange('listing:a:1', 0, 100))
开发者ID:MichalMaM,项目名称:ella,代码行数:19,代码来源:test_cache.py


示例13: test_access_to_individual_listings

    def test_access_to_individual_listings(self):
        list_all_publishables_in_category_by_hour(self)
        lh = Listing.objects.get_queryset_wrapper(category=self.category, children=ListingHandler.ALL, source='redis')
        l = lh[0]

        tools.assert_equals(l.publishable, self.listings[0].publishable)
开发者ID:MikeLing,项目名称:ella,代码行数:6,代码来源:test_cache.py


示例14: setUp

 def setUp(self):
     super(TestListingTag, self).setUp()
     create_basic_categories(self)
     create_and_place_a_publishable(self)
     create_and_place_more_publishables(self)
     list_all_publishables_in_category_by_hour(self)
开发者ID:whalerock,项目名称:ella,代码行数:6,代码来源:test_templatetags.py


示例15: setUp

 def setUp(self):
     super(TestListContentType, self).setUp()
     create_and_place_more_publishables(self)
     list_all_publishables_in_category_by_hour(self, category=self.category)
     self.list_content_type = ListContentType()
开发者ID:MichalMaM,项目名称:ella,代码行数:5,代码来源:test_view_helpers.py


示例16: test_nested_listings

 def test_nested_listings(self):
     list_all_publishables_in_category_by_hour(self, category=self.category_nested_second)
     list_all_publishables_in_category_by_hour(self, category=self.category_nested)
     l = Listing.objects.get_listing(category=self.category_nested, children=ListingHandler.ALL)
     tools.assert_equals(self.listings, list(l))
开发者ID:MikeLing,项目名称:ella,代码行数:5,代码来源:test_listing.py



注:本文中的test_ella.test_core.list_all_publishables_in_category_by_hour函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap