naming
This commit is contained in:
Родитель
10e1bd3ad2
Коммит
d4707ca31d
|
@ -1834,7 +1834,7 @@ class TestAddonModels(TestCase):
|
|||
# it's in the collection, so is now promoted.
|
||||
assert addon.promoted
|
||||
assert addon.promoted.addon == addon
|
||||
assert RECOMMENDED in addon.promoted.groups
|
||||
assert addon.promoted.in_group(RECOMMENDED)
|
||||
assert addon.promoted.application_id is None
|
||||
# This PromotedAddon instance is not a saved one.
|
||||
assert addon.promoted.id is None
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% macro render_status(addon) %}
|
||||
{% set promoted_group = addon.promoted_groups() %}
|
||||
{% set promoted_groups = addon.promoted_groups() %}
|
||||
{% if addon.status != amo.STATUS_DISABLED and addon.disabled_by_user %}
|
||||
{% set status_text = _('Invisible') %}
|
||||
{% elif addon.status == amo.STATUS_APPROVED and promoted_group.badged %}
|
||||
{% set status_text = _('Approved and %s' % promoted_group.name) %}
|
||||
{% elif addon.status == amo.STATUS_APPROVED and promoted_groups.badged %}
|
||||
{% set status_text = _('Approved and %s' % promoted_groups.name) %}
|
||||
{% else %}
|
||||
{% set status_text = addon.get_status_display() %}
|
||||
{% endif %}
|
||||
|
|
|
@ -238,7 +238,7 @@ class TestVersion(TestCase):
|
|||
self.addon.reload()
|
||||
assert self.addon.current_version == previous_version
|
||||
# It's still recommended.
|
||||
assert RECOMMENDED in self.addon.promoted_groups()
|
||||
assert self.addon.promoted_groups().in_group(RECOMMENDED)
|
||||
|
||||
def test_can_still_disable_or_delete_old_version_recommended(self):
|
||||
# If the add-on is recommended, you can still disable or delete older
|
||||
|
|
|
@ -58,7 +58,7 @@ class TestPrimaryHero(TestCase):
|
|||
ph.promoted_addon.approve_for_version(ph.promoted_addon.addon.current_version)
|
||||
ph.reload()
|
||||
ph.enabled = True
|
||||
assert RECOMMENDED in ph.promoted_addon.addon.promoted_groups()
|
||||
assert ph.promoted_addon.addon.promoted_groups().in_group(RECOMMENDED)
|
||||
ph.clean() # it raises if there's an error
|
||||
|
||||
# change to a different group
|
||||
|
@ -66,7 +66,7 @@ class TestPrimaryHero(TestCase):
|
|||
ph.promoted_addon.approve_for_version(ph.promoted_addon.addon.current_version)
|
||||
ph.reload()
|
||||
ph.enabled = True
|
||||
assert STRATEGIC in ph.promoted_addon.addon.promoted_groups()
|
||||
assert ph.promoted_addon.addon.promoted_groups().in_group(STRATEGIC)
|
||||
with self.assertRaises(ValidationError) as context:
|
||||
# STRATEGIC isn't a group that can be added as a primary hero
|
||||
ph.clean()
|
||||
|
@ -80,7 +80,7 @@ class TestPrimaryHero(TestCase):
|
|||
ph.promoted_addon.approve_for_version(ph.promoted_addon.addon.current_version)
|
||||
ph.reload()
|
||||
ph.enabled = True
|
||||
assert SPOTLIGHT in ph.promoted_addon.addon.promoted_groups()
|
||||
assert ph.promoted_addon.addon.promoted_groups().in_group(SPOTLIGHT)
|
||||
ph.clean() # it raises if there's an error
|
||||
|
||||
def test_clean_external_requires_homepage(self):
|
||||
|
|
|
@ -149,7 +149,7 @@ class TestPromotedAddonAdmin(TestCase):
|
|||
assert 'errors' not in response.context_data, response.context_data['errors']
|
||||
item.reload()
|
||||
assert PromotedAddon.objects.count() == 1
|
||||
assert LINE in item.groups
|
||||
assert item.in_group(LINE)
|
||||
assert PromotedApproval.objects.count() == 4 # same
|
||||
# now it's not promoted because the current_version isn't approved for
|
||||
# LINE group
|
||||
|
@ -254,7 +254,7 @@ class TestPromotedAddonAdmin(TestCase):
|
|||
|
||||
item.reload()
|
||||
assert PromotedAddon.objects.count() == 1
|
||||
assert RECOMMENDED in item.groups
|
||||
assert item.in_group(RECOMMENDED)
|
||||
assert PromotedApproval.objects.count() == 1
|
||||
|
||||
# Try to delete the approval instead
|
||||
|
@ -337,7 +337,7 @@ class TestPromotedAddonAdmin(TestCase):
|
|||
assert PromotedAddon.objects.count() == 1
|
||||
item = PromotedAddon.objects.get()
|
||||
assert item.addon == addon
|
||||
assert RECOMMENDED in item.groups
|
||||
assert item.in_group(RECOMMENDED)
|
||||
assert item.application_id is None
|
||||
assert item.all_applications == [amo.FIREFOX, amo.ANDROID]
|
||||
assert PromotedApproval.objects.count() == 0 # we didn't create any
|
||||
|
|
|
@ -21,7 +21,7 @@ class TestPromotedAddon(TestCase):
|
|||
promoted_addon = PromotedAddon.objects.create(
|
||||
addon=addon_factory(), group_id=promoted.LINE.id
|
||||
)
|
||||
assert promoted.LINE in promoted_addon.groups
|
||||
assert promoted_addon.in_group(promoted.LINE)
|
||||
assert promoted_addon.application_id is None
|
||||
assert promoted_addon.all_applications == [
|
||||
applications.FIREFOX,
|
||||
|
@ -74,7 +74,7 @@ class TestPromotedAddon(TestCase):
|
|||
promo = PromotedAddon.objects.create(
|
||||
addon=addon_factory(), application_id=amo.FIREFOX.id
|
||||
)
|
||||
assert not promo.groups
|
||||
assert promo.not_promoted
|
||||
assert promo.approved_applications == []
|
||||
assert not PromotedApproval.objects.exists()
|
||||
|
||||
|
@ -84,7 +84,7 @@ class TestPromotedAddon(TestCase):
|
|||
promo.addon.reload()
|
||||
assert promo.approved_applications == []
|
||||
assert not PromotedApproval.objects.exists()
|
||||
assert not promo.addon.promoted_groups()
|
||||
assert not promo.addon.promoted_groups().not_promoted
|
||||
|
||||
# then with a group thats immediate_approval == True
|
||||
promo.group_id = promoted.SPOTLIGHT.id
|
||||
|
@ -92,7 +92,7 @@ class TestPromotedAddon(TestCase):
|
|||
promo.addon.reload()
|
||||
assert promo.approved_applications == [amo.FIREFOX]
|
||||
assert PromotedApproval.objects.count() == 1
|
||||
assert promoted.SPOTLIGHT in promo.addon.promoted_groups()
|
||||
assert promo.addon.promoted_groups().in_group(promoted.SPOTLIGHT)
|
||||
|
||||
# test the edge case where the application was changed afterwards
|
||||
promo.application_id = 0
|
||||
|
@ -285,7 +285,7 @@ class TestPromotedAddon(TestCase):
|
|||
# SPOTLIGHT doesnt have special signing states so won't be resigned
|
||||
# approve_for_addon is called automatically - SPOTLIGHT has immediate_approval
|
||||
promo.addon.reload()
|
||||
assert promoted.SPOTLIGHT in promo.addon.promoted_groups()
|
||||
assert promo.addon.promoted_groups().in_group(promoted.SPOTLIGHT)
|
||||
assert promo.addon.current_version.version == '0.123a'
|
||||
|
||||
def test_signal(self):
|
||||
|
|
|
@ -3042,7 +3042,7 @@ class TestReviewHelper(TestReviewHelperBase):
|
|||
assert self.addon.current_version.promoted_approvals.filter(
|
||||
group_id=RECOMMENDED.id
|
||||
).exists()
|
||||
assert RECOMMENDED in self.addon.promoted_groups()
|
||||
assert self.addon.promoted_groups().in_group(RECOMMENDED)
|
||||
|
||||
def test_nominated_to_approved_other_promoted(self):
|
||||
self.make_addon_promoted(self.addon, LINE)
|
||||
|
@ -3060,7 +3060,7 @@ class TestReviewHelper(TestReviewHelperBase):
|
|||
assert self.addon.current_version.promoted_approvals.filter(
|
||||
group_id=RECOMMENDED.id
|
||||
).exists()
|
||||
assert RECOMMENDED in self.addon.promoted_groups()
|
||||
assert self.addon.promoted_groups().in_group(RECOMMENDED)
|
||||
|
||||
def test_approved_update_other_promoted(self):
|
||||
self.make_addon_promoted(self.addon, LINE)
|
||||
|
|
|
@ -1357,7 +1357,7 @@ class TestVersion(AMOPaths, TestCase):
|
|||
|
||||
self.make_addon_promoted(addon, RECOMMENDED, approve_version=True)
|
||||
addon = addon.reload()
|
||||
assert RECOMMENDED in addon.promoted_groups()
|
||||
addon.promoted_groups().in_group(RECOMMENDED)
|
||||
# But a promoted one, that's in a prereview group, can't be disabled
|
||||
assert not addon.current_version.can_be_disabled_and_deleted()
|
||||
|
||||
|
@ -1400,19 +1400,19 @@ class TestVersion(AMOPaths, TestCase):
|
|||
assert version_b.can_be_disabled_and_deleted()
|
||||
assert version_c.can_be_disabled_and_deleted()
|
||||
assert version_d.can_be_disabled_and_deleted()
|
||||
assert RECOMMENDED in addon.promoted_groups()
|
||||
addon.promoted_groups().in_group(RECOMMENDED)
|
||||
# now un-approve version_b
|
||||
version_b.promoted_approvals.update(group_id=NOT_PROMOTED.id)
|
||||
assert version_a.can_be_disabled_and_deleted()
|
||||
assert version_b.can_be_disabled_and_deleted()
|
||||
assert version_c.can_be_disabled_and_deleted()
|
||||
assert not version_d.can_be_disabled_and_deleted()
|
||||
assert RECOMMENDED in addon.promoted_groups()
|
||||
addon.promoted_groups().in_group(RECOMMENDED)
|
||||
|
||||
def test_unbadged_non_prereview_promoted_can_be_disabled_and_deleted(self):
|
||||
addon = Addon.objects.get(id=3615)
|
||||
self.make_addon_promoted(addon, LINE, approve_version=True)
|
||||
assert LINE in addon.promoted_groups()
|
||||
assert addon.promoted_groups().in_group(LINE)
|
||||
# it's the only version of a group that requires pre-review and is
|
||||
# badged, so can't be deleted.
|
||||
assert not addon.current_version.can_be_disabled_and_deleted()
|
||||
|
@ -1421,13 +1421,13 @@ class TestVersion(AMOPaths, TestCase):
|
|||
addon.promotedaddon.update(group_id=STRATEGIC.id)
|
||||
addon.current_version.promoted_approvals.update(group_id=STRATEGIC.id)
|
||||
del addon.current_version.approved_for_groups
|
||||
assert STRATEGIC in addon.promoted_groups()
|
||||
assert addon.promoted_groups().in_group(STRATEGIC)
|
||||
assert addon.current_version.can_be_disabled_and_deleted()
|
||||
|
||||
# SPOTLIGHT is pre-reviewed but not badged, so it's okay too
|
||||
addon.promotedaddon.update(group_id=SPOTLIGHT.id)
|
||||
addon.current_version.promoted_approvals.update(group_id=SPOTLIGHT.id)
|
||||
assert SPOTLIGHT in addon.promoted_groups()
|
||||
assert addon.promoted_groups().in_group(SPOTLIGHT)
|
||||
assert addon.current_version.can_be_disabled_and_deleted()
|
||||
|
||||
def test_can_be_disabled_and_deleted_querycount(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче