only examine lite status of the version (bug 624073)

This commit is contained in:
Jeff Balogh 2011-01-10 13:17:42 -07:00
Родитель 915c706a33
Коммит 2f48c28cd5
2 изменённых файлов: 32 добавлений и 3 удалений

Просмотреть файл

@ -82,9 +82,8 @@ class InstallButton(object):
self.detailed = detailed
self.is_beta = self.version and self.version.is_beta
version_unreviewed = (self.version and self.version.is_unreviewed)
self.lite = (addon.status in amo.LITE_STATUSES
or version and version.is_lite)
version_unreviewed = self.version and self.version.is_unreviewed
self.lite = self.version and self.version.is_lite
self.unreviewed = (addon.is_unreviewed() or version_unreviewed or
self.is_beta)
self.self_hosted = addon.status == amo.STATUS_LISTED

Просмотреть файл

@ -257,6 +257,7 @@ class TestButton(ButtonTest):
# Throw featured in there to make sure it's ignored.
self.addon.is_featured.return_value = True
self.addon.status = amo.STATUS_LITE
self.version.is_lite = True
b = self.get_button()
assert not b.featured
assert b.lite
@ -268,6 +269,33 @@ class TestButton(ButtonTest):
# Throw featured in there to make sure it's ignored.
self.addon.is_featured.return_value = True
self.addon.status = amo.STATUS_LITE_AND_NOMINATED
self.version.is_lite = True
b = self.get_button()
assert not b.featured
assert b.lite
eq_(b.button_class, ['caution'])
eq_(b.install_class, ['lite'])
eq_(b.install_text, 'Experimental')
def test_lite_unreviewed_version(self):
# Throw featured in there to make sure it's ignored.
self.addon.is_featured.return_value = True
self.addon.status = amo.STATUS_LITE
self.version.is_unreviewed = True
self.version.is_lite = False
b = self.get_button()
assert not b.featured
assert not b.lite
assert b.unreviewed
eq_(b.button_class, ['download', 'caution'])
eq_(b.install_class, ['unreviewed'])
eq_(b.install_text, 'Not Reviewed')
def test_public_with_lite_version(self):
# Throw featured in there to make sure it's ignored.
self.addon.is_featured.return_value = True
self.addon.status = amo.STATUS_PUBLIC
self.version.is_lite = True
b = self.get_button()
assert not b.featured
assert b.lite
@ -445,12 +473,14 @@ class TestButtonHtml(ButtonTest):
def test_lite_detailed_warning(self):
self.addon.status = amo.STATUS_LITE
self.version.is_lite = True
warning = self.render(detailed=True)('.install-shell .warning')
eq_(warning.text(),
'This add-on has been preliminarily reviewed by Mozilla. Learn more')
def test_lite_and_nom_detailed_warning(self):
self.addon.status = amo.STATUS_LITE_AND_NOMINATED
self.version.is_lite = True
warning = self.render(detailed=True)('.install-shell .warning')
eq_(warning.text(),
'This add-on has been preliminarily reviewed by Mozilla. Learn more')