当前位置: 首页>>代码示例>>Python>>正文


Python helpers.market_tile函数代码示例

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


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

示例1: test_is_premium_webapp_foreign

 def test_is_premium_webapp_foreign(self):
     self.make_premium(self.webapp, price='0.99')
     self.context['request'].REGION = regions.SPAIN
     # The region is set to Spain, so the currency is set EUR
     # and the display is set to French.
     with self.activate('fr'):
         # TODO bug: 878215, find what the answer here is.
         with self.assertRaises(KeyError):
             market_tile(self.context, self.webapp)
开发者ID:KryDos,项目名称:zamboni,代码行数:9,代码来源:test_helpers.py

示例2: test_developers

 def test_developers(self):
     AddonPremium.objects.create(price_id=1, addon_id=self.webapp.pk)
     AddonUser.objects.create(user=self.user, addon=self.webapp)
     self.webapp.update(premium_type=amo.ADDON_PREMIUM)
     doc = pq(market_tile(self.context, self.webapp))
     data = json.loads(doc('.mkt-tile').attr('data-product'))
     eq_(data['isPurchased'], True)
开发者ID:MikeLing,项目名称:zamboni,代码行数:7,代码来源:test_helpers.py

示例3: test_is_premium_android_disabled

 def test_is_premium_android_disabled(self):
     self.make_premium(self.webapp)
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Unexpected: %r' % cls
     eq_(doc('.bad-app').text(),
         'This app is available for purchase on only Firefox OS.')
开发者ID:KryDos,项目名称:zamboni,代码行数:7,代码来源:test_helpers.py

示例4: test_category

 def test_category(self):
     c = Category.objects.create(name='test-cat', type=amo.ADDON_WEBAPP)
     AddonCategory.objects.create(addon=self.webapp, category=c)
     doc = pq(market_tile(self.context, self.webapp))
     data = json.loads(doc('.mkt-tile').attr('data-product'))
     eq_(data['categories'],
         [str(cat.id) for cat in self.webapp.categories.all()])
开发者ID:KryDos,项目名称:zamboni,代码行数:7,代码来源:test_helpers.py

示例5: test_reviewers

 def test_reviewers(self, action_allowed):
     action_allowed.return_value = True
     doc = pq(market_tile(self.context, self.webapp))
     data = json.loads(doc('.mkt-tile').attr('data-product'))
     issue = urlparams(reverse('detail.record',
                               args=[self.webapp.app_slug]), src='foo')
     eq_(data['recordUrl'], issue)
开发者ID:KryDos,项目名称:zamboni,代码行数:7,代码来源:test_helpers.py

示例6: test_is_premium_webapp_foreign

 def test_is_premium_webapp_foreign(self):
     self.make_premium(self.webapp, price='0.99')
     self.context['request'].REGION = regions.SPAIN
     # The region is set to Spain, so the currency is set EUR
     # and the display is set to French.
     with self.activate('fr'):
         doc = pq(market_tile(self.context, self.webapp))
         eq_(doc('.price').text(), '')
开发者ID:wraithan,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例7: test_needs_firefox_for_android_upgrade

 def test_needs_firefox_for_android_upgrade(self):
     # Only Firefox for Android 17.0+ has support for `navigator.mozApps`.
     self.context['request'].META['HTTP_USER_AGENT'] = (
         'Mozilla/5.0 (Mobile; rv:16.0) Gecko/16.0 Firefox/16.0')
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Unexpected: %r' % cls
     eq_(doc('.bad-app').text(), 'To use this app, upgrade Firefox.')
开发者ID:gregglind,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例8: test_needs_firefox_for_android

 def test_needs_firefox_for_android(self):
     self.context['request'].META['HTTP_USER_AGENT'] = (
         'Mozilla/5.0 (Linux; U; Android 2.3.3; en-au; GT-I9100 Build)')
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Unexpected: %r' % cls
     eq_(doc('.bad-app').text(),
         'To use this app, download and install Firefox for Android .')
开发者ID:gregglind,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例9: test_can_install_mobile

 def test_can_install_mobile(self):
     self.webapp._device_types = [amo.DEVICE_MOBILE]
     self.context['request'].MOBILE = True
     self.context['request'].TABLET = False
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' not in cls, 'Unexpected: %r' % cls
     eq_(doc('.bad-app').length, 0)
开发者ID:KryDos,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例10: test_cannot_install_tablet_only

 def test_cannot_install_tablet_only(self):
     self.webapp._device_types = [amo.DEVICE_TABLET]
     self.context['request'].MOBILE = False
     self.context['request'].TABLET = False
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Expected: %r' % cls
     eq_(doc('.bad-app').length, 1)
开发者ID:KryDos,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例11: test_needs_firefox_for_android

 def test_needs_firefox_for_android(self):
     self.context['request'].META['HTTP_USER_AGENT'] = (
         'Mozilla/5.0 (Linux; U; Android 2.3.3; en-au; GT-I9100 Build)')
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Could not find %r class' % cls
     assert 'incompatible' in cls, 'Could not find %r class' % cls
     eq_(doc('.bad-app').length, 0)
开发者ID:KryDos,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例12: test_is_premium_disabled

 def test_is_premium_disabled(self):
     self.make_premium(self.webapp)
     self.create_switch(name='disabled-payments')
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Unexpected: %r' % cls
     eq_(doc('.bad-app').text(),
         'This app is temporarily unavailable for purchase.')
开发者ID:KryDos,项目名称:zamboni,代码行数:8,代码来源:test_helpers.py

示例13: test_is_not_packaged

    def test_is_not_packaged(self):
        manifest_url = self.webapp.manifest_url

        doc = pq(market_tile(self.context, self.webapp))
        assert 'data-manifest_url="%s"' % manifest_url in doc.html()

        data = json.loads(doc('a').attr('data-product'))
        eq_(data['is_packaged'], False)
        eq_(data['manifest_url'], manifest_url)
开发者ID:KryDos,项目名称:zamboni,代码行数:9,代码来源:test_helpers.py

示例14: test_needs_firefox_for_android_upgrade

 def test_needs_firefox_for_android_upgrade(self):
     # Only Firefox for Android 17.0+ has support for `navigator.mozApps`.
     self.context['request'].META['HTTP_USER_AGENT'] = (
         'Mozilla/5.0 (Mobile; rv:16.0) Gecko/16.0 Firefox/16.0')
     doc = pq(market_tile(self.context, self.webapp))
     cls = doc('button').attr('class')
     assert 'disabled' in cls, 'Could not find %r class' % cls
     assert 'incompatible' in cls, 'Could not find %r class' % cls
     eq_(doc('.bad-app').length, 0)
开发者ID:KryDos,项目名称:zamboni,代码行数:9,代码来源:test_helpers.py

示例15: test_is_premium_webapp_gaia

    def test_is_premium_webapp_gaia(self):
        self.context['request'].GAIA = True
        self.make_premium(self.webapp)
        doc = pq(market_tile(self.context, self.webapp))
        eq_(doc('.price').text(), '$1.00')

        cls = doc('button').attr('class')
        assert 'disabled' not in cls, 'Unexpected: %r' % cls
        eq_(doc('.bad-app').length, 0)
开发者ID:KryDos,项目名称:zamboni,代码行数:9,代码来源:test_helpers.py


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