本文整理汇总了Python中addons.models.Addon.status方法的典型用法代码示例。如果您正苦于以下问题:Python Addon.status方法的具体用法?Python Addon.status怎么用?Python Addon.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类addons.models.Addon
的用法示例。
在下文中一共展示了Addon.status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_takes_contributions
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import status [as 别名]
def test_takes_contributions(self):
a = Addon(status=amo.STATUS_PUBLIC, wants_contributions=True,
paypal_id='$$')
assert a.takes_contributions
a.status = amo.STATUS_UNREVIEWED
assert not a.takes_contributions
a.status = amo.STATUS_PUBLIC
a.wants_contributions = False
assert not a.takes_contributions
a.wants_contributions = True
a.paypal_id = None
assert not a.takes_contributions
a.charity_id = 12
assert a.takes_contributions
示例2: test_show_beta_with_beta_version
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import status [as 别名]
def test_show_beta_with_beta_version(self, beta_mock):
beta_mock.return_value = object()
# Fake current_beta_version to return something truthy.
a = Addon(status=amo.STATUS_PUBLIC)
assert a.show_beta
# We have a beta version but status has to be public.
a.status = amo.STATUS_UNREVIEWED
assert not a.show_beta
示例3: test_support_addon
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import status [as 别名]
def test_support_addon(self):
a = Addon(id=12, type=1)
eq_(support_addon(a), '')
a.wants_contributions = a.paypal_id = True
a.status = amo.STATUS_PUBLIC
eq_(PyQuery(support_addon(a))('a').text(), 'Support this add-on')
a.suggested_amount = '12'
doc = PyQuery(support_addon(a))
eq_(doc('.contribute').text(),
'Support this add-on: Contribute $12.00')
示例4: test_is_unreviewed
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import status [as 别名]
def test_is_unreviewed(self):
"""Test if add-on is unreviewed or not"""
# public add-on
a = Addon.objects.get(pk=3615)
assert not a.is_unreviewed(), 'public add-on: is_unreviewed=False'
# unreviewed add-on
a = Addon(status=amo.STATUS_UNREVIEWED)
assert a.is_unreviewed(), 'sandboxed add-on: is_unreviewed=True'
a.status = amo.STATUS_PENDING
assert a.is_unreviewed(), 'pending add-on: is_unreviewed=True'
示例5: test_personas_landing
# 需要导入模块: from addons.models import Addon [as 别名]
# 或者: from addons.models.Addon import status [as 别名]
def test_personas_landing(self):
"""Show landing page if there are greater than 4 Personas."""
for i in xrange(3):
a = Addon(type=amo.ADDON_PERSONA)
a.name = 'persona-%s' % i
a.all_categories = []
a.save()
v = Version.objects.get(addon=Addon.objects.get(id=15679))
v.addon = a
v.pk = None
v.save()
p = Persona(addon_id=a.id, persona_id=i)
p.save()
a.persona = p
a._current_version = v
a.status = amo.STATUS_PUBLIC
a.save()
base = (Addon.objects.public().filter(type=amo.ADDON_PERSONA)
.extra(select={'_app': amo.FIREFOX.id}))
eq_(base.count(), 5)
r = self.client.get(reverse('browse.personas'))
self.assertTemplateUsed(r, 'browse/personas/category_landing.html')