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

Python tasks.unindex_webapps函数代码示例

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

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



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

示例1: tearDownClass

 def tearDownClass(cls):
     if hasattr(cls, '_addons'):
         Addon.objects.filter(pk__in=[a.id for a in cls._addons]).delete()
         unindex_webapps([a.id for a in cls._addons
                          if a.type == amo.ADDON_WEBAPP])
         unindex_addons([a.id for a in cls._addons
                         if a.type != amo.ADDON_WEBAPP])
开发者ID:chilyashev,项目名称:zamboni,代码行数:7,代码来源:__init__.py


示例2: test_adolescent_popularity

    def test_adolescent_popularity(self):
        """
        Adolescent regions use global popularity.

          Webapp:   Global: 0, Regional: 0
          Unknown1: Global: 1, Regional: 1 + 10 * 1 = 11
          Unknown2: Global: 2, Regional: 0

        """
        # TODO: help from robhudson.
        raise SkipTest

        unknown1 = amo.tests.app_factory()
        unknown2 = amo.tests.app_factory()
        self.reindex(Webapp, 'webapp')

        res = self.client.get(self.url, data={'region': 'br'})
        eq_(res.status_code, 200)

        objects = res.json['objects']
        eq_(len(objects), 3)

        eq_(int(objects[0]['id']), unknown2.id)
        eq_(int(objects[1]['id']), unknown1.id)
        eq_(int(objects[2]['id']), self.webapp.id)

        # Cleanup to remove these from the index.
        unknown1.delete()
        unknown2.delete()
        unindex_webapps([unknown1.id, unknown2.id])
开发者ID:jinankjain,项目名称:zamboni,代码行数:30,代码来源:test_views.py


示例3: test_adolescent_popularity

    def test_adolescent_popularity(self):
        """
        Adolescent regions use global popularity.

          Webapp:   Global: 0, Regional: 0
          Unknown1: Global: 1, Regional: 1 + 10 * 1 = 11
          Unknown2: Global: 2, Regional: 0

        """
        user = UserProfile.objects.all()[0]
        cd = ClientData.objects.create(region=mkt.regions.BR.id)

        unknown1 = amo.tests.app_factory()
        Installed.objects.create(addon=unknown1, user=user, client_data=cd)

        unknown2 = amo.tests.app_factory()
        Installed.objects.create(addon=unknown2, user=user)
        Installed.objects.create(addon=unknown2, user=user)

        self.reindex(Webapp, 'webapp')

        res = self.client.get(self.url, data={'region': 'br'})
        eq_(res.status_code, 200)

        objects = res.json['objects']
        eq_(len(objects), 3)

        eq_(int(objects[0]['id']), unknown2.id)
        eq_(int(objects[1]['id']), unknown1.id)
        eq_(int(objects[2]['id']), self.webapp.id)

        # Cleanup to remove these from the index.
        unindex_webapps([unknown1.id, unknown2.id])
        unknown1.delete()
        unknown2.delete()
开发者ID:bdacode,项目名称:zamboni,代码行数:35,代码来源:test_api.py


示例4: test_no_category

 def test_no_category(self):
     app2 = app_factory()
     self.make_featured(app=app2, category=self.cat)
     self.reindex(Webapp, 'webapp')
     res = self.client.get(self.list_url + (self.qs,))
     eq_(res.status_code, 200)
     eq_(len(res.json['featured']), 1)
     eq_(int(res.json['featured'][0]['id']), self.app.pk)
     unindex_webapps([app2.id])
     app2.delete()
开发者ID:at13,项目名称:zamboni,代码行数:10,代码来源:test_api.py


示例5: tearDownClass

 def tearDownClass(cls):
     try:
         if hasattr(cls, "_addons"):
             Addon.objects.filter(pk__in=[a.id for a in cls._addons]).delete()
             unindex_webapps([a.id for a in cls._addons if a.type == amo.ADDON_WEBAPP])
         amo.SEARCH_ANALYZER_MAP = cls._SEARCH_ANALYZER_MAP
     finally:
         # Make sure we're calling super's tearDownClass even if something
         # went wrong in the code above, as otherwise we'd run into bug
         # 960598.
         super(ESTestCase, cls).tearDownClass()
开发者ID:petercpg,项目名称:zamboni,代码行数:11,代码来源:__init__.py


示例6: test_featured_plus_category

    def test_featured_plus_category(self):
        app2 = amo.tests.app_factory()
        AddonCategory.objects.get_or_create(addon=app2, category=self.cat)
        self.reindex(Webapp, 'webapp')

        res = self.client.get(self.list_url + (self.qs,))
        eq_(res.status_code, 200)
        eq_(len(res.json['objects']), 2)
        eq_(len(res.json['featured']), 1)
        eq_(int(res.json['featured'][0]['id']), self.app.pk)
        unindex_webapps([app2.id])
        app2.delete()
开发者ID:at13,项目名称:zamboni,代码行数:12,代码来源:test_api.py


示例7: test_q_exact

    def test_q_exact(self):
        app1 = app_factory(name='test app test11')
        app2 = app_factory(name='test app test21')
        app3 = app_factory(name='test app test31')
        self.refresh('webapp')

        res = self.client.get(self.url, data={'q': 'test app test21'})
        eq_(res.status_code, 200)
        eq_(len(res.json['objects']), 3)
        # app2 should be first since it's an exact match and is boosted higher.
        obj = res.json['objects'][0]
        eq_(obj['slug'], app2.app_slug)

        unindex_webapps([app1.id, app2.id, app3.id])
        app1.delete()
        app2.delete()
        app3.delete()
开发者ID:bdacode,项目名称:zamboni,代码行数:17,代码来源:test_api.py


示例8: tearDownClass

 def tearDownClass(cls):
     try:
         if hasattr(cls, '_addons'):
             addons = Webapp.objects.filter(
                 pk__in=[a.id for a in cls._addons])
             # First delete all the translations.
             for addon in addons:
                 for field in addon._meta.translated_fields:
                     delete_translation(addon, field.name)
             addons.delete()
             unindex_webapps([a.id for a in cls._addons])
         mkt.SEARCH_ANALYZER_MAP = cls._SEARCH_ANALYZER_MAP
     finally:
         # Make sure we're calling super's tearDownClass even if something
         # went wrong in the code above, as otherwise we'd run into bug
         # 960598.
         super(ESTestCase, cls).tearDownClass()
开发者ID:clouserw,项目名称:zamboni,代码行数:17,代码来源:__init__.py


示例9: test_upsell

    def test_upsell(self):
        upsell = app_factory()
        AddonUpsell.objects.create(free=self.webapp, premium=upsell)
        self.webapp.save()
        self.refresh('webapp')

        res = self.client.get(self.url)
        eq_(res.status_code, 200)
        obj = res.json['objects'][0]
        eq_(obj['upsell']['id'], upsell.id)
        eq_(obj['upsell']['app_slug'], upsell.app_slug)
        eq_(obj['upsell']['name'], upsell.name)
        eq_(obj['upsell']['icon_url'], upsell.get_icon_url(128))
        eq_(obj['upsell']['resource_uri'], '/api/v1/apps/app/%s/' % upsell.id)

        unindex_webapps([upsell.id])
        upsell.delete()
开发者ID:at13,项目名称:zamboni,代码行数:17,代码来源:test_api.py


示例10: test_upsell

    def test_upsell(self):
        upsell = app_factory(premium_type=amo.ADDON_PREMIUM)
        AddonUpsell.objects.create(free=self.webapp, premium=upsell)
        self.webapp.save()
        self.refresh('webapp')

        res = self.client.get(self.url, {'premium_types': 'free'})
        eq_(res.status_code, 200)
        eq_(len(res.json['objects']), 1)
        obj = res.json['objects'][0]
        eq_(obj['upsell']['id'], upsell.id)
        eq_(obj['upsell']['app_slug'], upsell.app_slug)
        eq_(obj['upsell']['name'], upsell.name)
        eq_(obj['upsell']['icon_url'], upsell.get_icon_url(128))
        eq_(obj['upsell']['resource_uri'], '/api/v1/apps/app/%s/' % upsell.id)
        eq_(obj['upsell']['region_exclusions'], [])

        unindex_webapps([upsell.id])
        upsell.delete()
开发者ID:rhelmer,项目名称:zamboni,代码行数:19,代码来源:test_api.py


示例11: tearDown

 def tearDown(self):
     unindex_webapps(list(Webapp.with_deleted.values_list('id', flat=True)))
     Webapp.objects.all().delete()
     super(TestApi, self).tearDown()
开发者ID:bdacode,项目名称:zamboni,代码行数:4,代码来源:test_api.py


示例12: tearDown

 def tearDown(self):
     unindex_webapps([self.w1.id, self.w2.id])
     self.w1.delete()
     self.w2.delete()
开发者ID:almosteverywhere,项目名称:zamboni,代码行数:4,代码来源:test_views.py


示例13: tearDownClass

 def tearDownClass(cls):
     if hasattr(cls, "_addons"):
         Addon.objects.filter(pk__in=[a.id for a in cls._addons]).delete()
         unindex_webapps([a.id for a in cls._addons if a.type == amo.ADDON_WEBAPP])
         unindex_addons([a.id for a in cls._addons if a.type != amo.ADDON_WEBAPP])
     amo.SEARCH_ANALYZER_MAP = cls._SEARCH_ANALYZER_MAP
开发者ID:gonzalodelgado,项目名称:zamboni,代码行数:6,代码来源:__init__.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tasks.update_manifests函数代码示例发布时间:2022-05-27
下一篇:
Python tasks.notify_developers_of_failure函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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