finish cleaning up preliminary review
This commit is contained in:
Родитель
1e18c7708e
Коммит
3fdb0cae8a
|
@ -25,7 +25,7 @@ except ImportError:
|
|||
from olympia.constants import applications, base
|
||||
|
||||
from utils import (
|
||||
APP_GUIDS, get_mirror, log_configure, PLATFORMS, STATUSES_PUBLIC)
|
||||
APP_GUIDS, get_mirror, log_configure, PLATFORMS)
|
||||
|
||||
# Go configure the log.
|
||||
log_configure()
|
||||
|
@ -134,7 +134,7 @@ class Update(object):
|
|||
def get_update(self):
|
||||
data = self.data
|
||||
|
||||
data.update(STATUSES_PUBLIC)
|
||||
data['STATUS_PUBLIC'] = base.STATUS_PUBLIC
|
||||
data['STATUS_BETA'] = base.STATUS_BETA
|
||||
data['STATUS_DISABLED'] = base.STATUS_DISABLED
|
||||
|
||||
|
@ -196,21 +196,6 @@ class Update(object):
|
|||
addons.status = %(STATUS_PUBLIC)s AND
|
||||
files.status = %(STATUS_BETA)s
|
||||
|
||||
WHEN addons.status IN (%(STATUS_LITE)s,
|
||||
%(STATUS_LITE_AND_NOMINATED)s)
|
||||
AND (curfile.id IS NULL OR
|
||||
curfile.status IN (%(STATUS_LITE)s,
|
||||
%(STATUS_DISABLED)s))
|
||||
THEN
|
||||
-- Add-on is prelim, and user's current version is either a
|
||||
-- known prelim, or an unknown version.
|
||||
--
|
||||
-- Serve only prelim versions. Serving a full version here
|
||||
-- will prevent users from receiving further updates until
|
||||
-- the add-on achieves full review.
|
||||
|
||||
files.status = %(STATUS_LITE)s
|
||||
|
||||
ELSE
|
||||
-- Anything else, including:
|
||||
--
|
||||
|
|
|
@ -28,8 +28,7 @@ from olympia.lib.log_settings_base import formatters, handlers
|
|||
# remove all this.
|
||||
from olympia.constants.applications import APPS_ALL
|
||||
from olympia.constants.platforms import PLATFORMS
|
||||
from olympia.constants.base import (
|
||||
STATUS_PUBLIC, STATUS_DISABLED, STATUS_LITE, STATUS_LITE_AND_NOMINATED)
|
||||
from olympia.constants.base import STATUS_DISABLED
|
||||
|
||||
|
||||
# This is not DRY: it's a copy of amo.helpers.user_media_path, to avoid an
|
||||
|
@ -75,11 +74,6 @@ ADDON_SLUGS_UPDATE = {
|
|||
7: 'plugin'}
|
||||
|
||||
|
||||
STATUSES_PUBLIC = {'STATUS_PUBLIC': STATUS_PUBLIC,
|
||||
'STATUS_LITE': STATUS_LITE,
|
||||
'STATUS_LITE_AND_NOMINATED': STATUS_LITE_AND_NOMINATED}
|
||||
|
||||
|
||||
version_re = re.compile(r"""(?P<major>\d+) # major (x in x.y)
|
||||
\.(?P<minor1>\d+) # minor1 (y in x.y)
|
||||
\.?(?P<minor2>\d+|\*)? # minor2 (z in x.y.z)
|
||||
|
|
|
@ -75,7 +75,6 @@ def install_button_factory(*args, **kwargs):
|
|||
# Order matters. We want to highlight unreviewed before featured. They
|
||||
# should be mutually exclusive, but you never know.
|
||||
classes = (('is_persona', PersonaInstallButton),
|
||||
('lite', LiteInstallButton),
|
||||
('unreviewed', UnreviewedInstallButton),
|
||||
('experimental', ExperimentalInstallButton),
|
||||
('featured', FeaturedInstallButton))
|
||||
|
@ -110,12 +109,10 @@ class InstallButton(object):
|
|||
|
||||
self.is_beta = self.version and self.version.is_beta
|
||||
version_unreviewed = self.version and self.version.is_unreviewed
|
||||
self.lite = self.version and self.version.is_lite
|
||||
self.experimental = addon.is_experimental
|
||||
self.unreviewed = (addon.is_unreviewed() or version_unreviewed or
|
||||
self.is_beta)
|
||||
self.featured = (not self.unreviewed and
|
||||
not self.lite and
|
||||
not self.experimental and
|
||||
not self.is_beta and
|
||||
addon.is_featured(app, lang))
|
||||
|
@ -159,7 +156,7 @@ class InstallButton(object):
|
|||
return []
|
||||
rv = []
|
||||
files = [f for f in self.version.all_files
|
||||
if f.status in amo.VALID_STATUSES]
|
||||
if f.status in amo.VALID_FILE_STATUSES]
|
||||
for file in files:
|
||||
text, url, os = self.file_details(file)
|
||||
rv.append(Link(text, self.fix_link(url), os, file))
|
||||
|
@ -207,12 +204,6 @@ class UnreviewedInstallButton(InstallButton):
|
|||
button_class = 'download caution'.split()
|
||||
|
||||
|
||||
class LiteInstallButton(InstallButton):
|
||||
install_class = ['lite']
|
||||
button_class = ['caution']
|
||||
install_text = pgettext_lazy('install_button', u'Experimental')
|
||||
|
||||
|
||||
class ExperimentalInstallButton(InstallButton):
|
||||
install_class = ['lite']
|
||||
button_class = ['caution']
|
||||
|
|
|
@ -171,7 +171,7 @@ def update_addon_appsupport():
|
|||
Q(appsupport__created__isnull=True))
|
||||
# Search providers don't list supported apps.
|
||||
has_app = Q(versions__apps__isnull=False) | Q(type=amo.ADDON_SEARCH)
|
||||
has_file = Q(versions__files__status__in=amo.VALID_STATUSES)
|
||||
has_file = Q(versions__files__status__in=amo.VALID_FILE_STATUSES)
|
||||
good = Q(has_app, has_file) | Q(type=amo.ADDON_PERSONA)
|
||||
ids = (Addon.objects.valid().distinct()
|
||||
.filter(newish, good).values_list('id', flat=True))
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
"homepage": 1325249,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": 1325258,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
"homepage": 13252949,
|
||||
"support_email": 13252963,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": 13252958,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
"homepage": null,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
"homepage": null,
|
||||
"support_email": null,
|
||||
"public_stats": 0,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
"total_downloads": 17046775,
|
||||
"icon_type": "image/png",
|
||||
"homepage": null,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"description": null,
|
||||
"target_locale": "",
|
||||
"site_specific": 0,
|
||||
|
|
|
@ -82,6 +82,6 @@ def get_review_type(file_):
|
|||
addon_status = file_.version.addon.status
|
||||
if addon_status == amo.STATUS_NOMINATED or (
|
||||
addon_status == amo.STATUS_PUBLIC and
|
||||
file_.status == amo.STATUS_UNREVIEWED):
|
||||
file_.status == amo.STATUS_AWAITING_REVIEW):
|
||||
# Add-on or file is waiting for a full review.
|
||||
return 'full'
|
||||
|
|
|
@ -8,7 +8,6 @@ from celery import chord, group
|
|||
from olympia import amo
|
||||
from olympia.addons.models import Addon
|
||||
from olympia.addons.tasks import (
|
||||
migrate_preliminary_to_full,
|
||||
populate_e10s_feature_compatibility, update_latest_version)
|
||||
from olympia.amo.utils import chunked
|
||||
from olympia.devhub.tasks import (
|
||||
|
@ -43,18 +42,8 @@ tasks = {
|
|||
amo.ADDON_DICT,
|
||||
amo.ADDON_LPADDON,
|
||||
amo.ADDON_PLUGIN]),
|
||||
Q(status__in=amo.VALID_STATUSES),
|
||||
Q(status__in=amo.VALID_ADDON_STATUSES),
|
||||
Q(_latest_version__files__status=amo.STATUS_DISABLED)]},
|
||||
'migrate_preliminary': {
|
||||
'method': migrate_preliminary_to_full,
|
||||
'qs': [Q(type__in=[amo.ADDON_EXTENSION,
|
||||
amo.ADDON_THEME,
|
||||
amo.ADDON_DICT,
|
||||
amo.ADDON_SEARCH,
|
||||
amo.ADDON_LPAPP,
|
||||
amo.ADDON_LPADDON,
|
||||
amo.ADDON_PLUGIN])],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,10 +15,6 @@ class Command(BaseCommand):
|
|||
make_option('--signing-server', action='store', type='string',
|
||||
dest='signing_server',
|
||||
help='The signing server to use for full reviews'),
|
||||
make_option('--preliminary-signing-server', action='store',
|
||||
type='string',
|
||||
dest='preliminary_signing_server',
|
||||
help='The signing server to use for preliminary reviews'),
|
||||
make_option('--force', action='store_true', dest='force',
|
||||
help='Sign the addon if it is already signed'),
|
||||
make_option('--reason', action='store', type='string', dest='reason',
|
||||
|
@ -33,12 +29,9 @@ class Command(BaseCommand):
|
|||
'sign them all, use the "process_addons --task sign_addons" '
|
||||
'management command.')
|
||||
full_server = options.get('signing_server') or settings.SIGNING_SERVER
|
||||
prelim_server = (options.get('preliminary_signing_server') or
|
||||
settings.PRELIMINARY_SIGNING_SERVER)
|
||||
|
||||
addon_ids = [int(addon_id) for addon_id in args]
|
||||
with override_settings(
|
||||
SIGNING_SERVER=full_server,
|
||||
PRELIMINARY_SIGNING_SERVER=prelim_server):
|
||||
SIGNING_SERVER=full_server):
|
||||
sign_addons(
|
||||
addon_ids, force=options['force'], reason=options['reason'])
|
||||
|
|
|
@ -165,19 +165,19 @@ class AddonManager(ManagerBase):
|
|||
|
||||
def unreviewed(self):
|
||||
"""Get only unreviewed add-ons"""
|
||||
return self.filter(self.valid_q(amo.UNREVIEWED_STATUSES))
|
||||
return self.filter(self.valid_q(amo.UNREVIEWED_ADDON_STATUSES))
|
||||
|
||||
def valid(self):
|
||||
"""Get valid, enabled add-ons only"""
|
||||
return self.filter(self.valid_q(amo.LISTED_STATUSES))
|
||||
return self.filter(self.valid_q(amo.VALID_ADDON_STATUSES))
|
||||
|
||||
def valid_and_disabled_and_pending(self):
|
||||
"""
|
||||
Get valid, pending, enabled and disabled add-ons.
|
||||
Used to allow pending theme pages to still be viewed.
|
||||
"""
|
||||
statuses = list(amo.LISTED_STATUSES) + [amo.STATUS_DISABLED,
|
||||
amo.STATUS_PENDING]
|
||||
statuses = (list(amo.VALID_ADDON_STATUSES) +
|
||||
[amo.STATUS_DISABLED, amo.STATUS_PENDING])
|
||||
return (self.filter(Q(status__in=statuses) | Q(disabled_by_user=True))
|
||||
.exclude(type=amo.ADDON_EXTENSION,
|
||||
_current_version__isnull=True))
|
||||
|
@ -658,13 +658,7 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
def valid_file_statuses(self):
|
||||
if self.status == amo.STATUS_PUBLIC:
|
||||
return [amo.STATUS_PUBLIC]
|
||||
|
||||
if self.status in (amo.STATUS_LITE,
|
||||
amo.STATUS_LITE_AND_NOMINATED):
|
||||
return [amo.STATUS_PUBLIC, amo.STATUS_LITE,
|
||||
amo.STATUS_LITE_AND_NOMINATED]
|
||||
|
||||
return amo.VALID_STATUSES
|
||||
return amo.VALID_FILE_STATUSES
|
||||
|
||||
def get_version(self):
|
||||
"""Retrieve the latest public version of an addon."""
|
||||
|
@ -1041,25 +1035,23 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
status = amo.STATUS_NULL
|
||||
logit('no versions')
|
||||
elif not versions.filter(
|
||||
files__status__in=amo.VALID_STATUSES).exists():
|
||||
files__status__in=amo.VALID_FILE_STATUSES).exists():
|
||||
status = amo.STATUS_NULL
|
||||
logit('no version with valid file')
|
||||
elif (self.status == amo.STATUS_PUBLIC and
|
||||
not versions.filter(files__status=amo.STATUS_PUBLIC).exists()):
|
||||
if versions.filter(files__status=amo.STATUS_LITE).exists():
|
||||
status = amo.STATUS_LITE
|
||||
logit('only lite files')
|
||||
elif versions.filter(files__status=amo.STATUS_UNREVIEWED).exists():
|
||||
if versions.filter(
|
||||
files__status=amo.STATUS_AWAITING_REVIEW).exists():
|
||||
status = amo.STATUS_NOMINATED
|
||||
logit('only an unreviewed file')
|
||||
else:
|
||||
status = amo.STATUS_NULL
|
||||
logit('no reviewed files')
|
||||
elif (self.status in amo.REVIEWED_STATUSES and
|
||||
elif (self.status == amo.STATUS_PUBLIC and
|
||||
self.latest_version and
|
||||
self.latest_version.has_files and
|
||||
(self.latest_version.all_files[0].status
|
||||
in amo.UNDER_REVIEW_STATUSES)):
|
||||
(self.latest_version.all_files[0].status ==
|
||||
amo.STATUS_AWAITING_REVIEW)):
|
||||
# Addon is public, but its latest file is not (it's the case on a
|
||||
# new file upload). So, call update, to trigger watch_status, which
|
||||
# takes care of setting nomination time when needed.
|
||||
|
@ -1222,37 +1214,21 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
except IndexError:
|
||||
return settings.STATIC_URL + '/img/icons/no-preview.png'
|
||||
|
||||
def can_request_review(self, disallow_preliminary_review=False):
|
||||
def can_request_review(self):
|
||||
"""Return the statuses an add-on can request."""
|
||||
if not File.objects.filter(version__addon=self):
|
||||
return ()
|
||||
if disallow_preliminary_review:
|
||||
if (self.is_disabled or
|
||||
self.status in (amo.STATUS_PUBLIC,
|
||||
amo.STATUS_LITE_AND_NOMINATED,
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_DELETED) or
|
||||
not self.latest_version or
|
||||
not self.latest_version.files.exclude(
|
||||
status=amo.STATUS_DISABLED).exists()):
|
||||
return ()
|
||||
else:
|
||||
return (amo.STATUS_PUBLIC,)
|
||||
|
||||
if (self.is_disabled or
|
||||
self.status in (amo.STATUS_PUBLIC,
|
||||
amo.STATUS_LITE_AND_NOMINATED,
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_DELETED) or
|
||||
not self.latest_version or
|
||||
not self.latest_version.files.exclude(
|
||||
status=amo.STATUS_DISABLED)):
|
||||
status=amo.STATUS_DISABLED).exists()):
|
||||
return ()
|
||||
elif self.status == amo.STATUS_NOMINATED:
|
||||
return (amo.STATUS_LITE,)
|
||||
elif self.status in [amo.STATUS_UNREVIEWED, amo.STATUS_LITE]:
|
||||
return (amo.STATUS_PUBLIC,)
|
||||
else:
|
||||
return (amo.STATUS_LITE, amo.STATUS_PUBLIC)
|
||||
return (amo.STATUS_PUBLIC,)
|
||||
|
||||
def is_persona(self):
|
||||
return self.type == amo.ADDON_PERSONA
|
||||
|
@ -1274,7 +1250,7 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
return self.status in amo.UNDER_REVIEW_STATUSES
|
||||
|
||||
def is_unreviewed(self):
|
||||
return self.status in amo.UNREVIEWED_STATUSES
|
||||
return self.status in amo.UNREVIEWED_ADDON_STATUSES
|
||||
|
||||
def is_public(self):
|
||||
return self.status == amo.STATUS_PUBLIC and not self.disabled_by_user
|
||||
|
@ -1384,21 +1360,15 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
.exclude(type=amo.ADDON_PERSONA)
|
||||
.values('id').annotate(last_updated=status_change))
|
||||
|
||||
lite = (Addon.objects.no_cache()
|
||||
.filter(status__in=amo.LISTED_STATUSES,
|
||||
versions__files__status=amo.STATUS_LITE)
|
||||
.values('id').annotate(last_updated=status_change))
|
||||
|
||||
stati = amo.LISTED_STATUSES + (amo.STATUS_PUBLIC,)
|
||||
stati = amo.VALID_ADDON_STATUSES
|
||||
exp = (Addon.objects.no_cache().exclude(status__in=stati)
|
||||
.filter(versions__files__status__in=amo.VALID_STATUSES)
|
||||
.filter(versions__files__status__in=amo.VALID_FILE_STATUSES)
|
||||
.values('id')
|
||||
.annotate(last_updated=Max('versions__files__created')))
|
||||
|
||||
personas = (Addon.objects.no_cache().filter(type=amo.ADDON_PERSONA)
|
||||
.extra(select={'last_updated': 'created'}))
|
||||
return dict(public=public, exp=exp, personas=personas,
|
||||
lite=lite)
|
||||
return dict(public=public, exp=exp, personas=personas)
|
||||
|
||||
@amo.cached_property(writable=True)
|
||||
def all_categories(self):
|
||||
|
|
|
@ -21,9 +21,7 @@ from olympia.amo.storage_utils import rm_stored_dir
|
|||
from olympia.amo.utils import cache_ns_key, ImageCheck, LocalFileStorage
|
||||
from olympia.editors.models import RereviewQueueTheme
|
||||
from olympia.lib.es.utils import index_objects
|
||||
from olympia.files.models import File
|
||||
from olympia.files.utils import parse_xpi
|
||||
from olympia.users.models import UserProfile
|
||||
from olympia.versions.models import Version
|
||||
|
||||
# pulling tasks from cron
|
||||
|
@ -414,62 +412,3 @@ def populate_e10s_feature_compatibility(ids, **kwargs):
|
|||
AddonFeatureCompatibility.objects.get_or_create(addon=addon)[0]
|
||||
)
|
||||
feature_compatibility.update(e10s=parsed['e10s_compatibility'])
|
||||
|
||||
|
||||
@task
|
||||
@write
|
||||
def migrate_preliminary_to_full(ids, **kwargs):
|
||||
log.info(
|
||||
'[%s@%s] Removing preliminary status from all addons starting w/ id: '
|
||||
'%s...' % (len(ids), migrate_preliminary_to_full.rate_limit, ids[0]))
|
||||
addons = Addon.unfiltered.filter(pk__in=ids)
|
||||
ids_to_email = []
|
||||
|
||||
for addon in addons:
|
||||
# Add-on is preliminary reviewed, so make it full and experimental.
|
||||
files = File.objects.filter(version__addon=addon)
|
||||
if addon.status == amo.STATUS_LITE:
|
||||
files.filter(status=amo.STATUS_LITE).update(
|
||||
status=amo.STATUS_PUBLIC)
|
||||
files.filter(original_status=amo.STATUS_LITE).update(
|
||||
original_status=amo.STATUS_PUBLIC)
|
||||
addon.update(status=amo.STATUS_PUBLIC, is_experimental=True)
|
||||
add_note = True
|
||||
# Add-on is waiting for preliminary approval, so make it nominated and
|
||||
# experimental.
|
||||
elif addon.status == amo.STATUS_UNREVIEWED:
|
||||
addon.update(status=amo.STATUS_NOMINATED, is_experimental=True)
|
||||
add_note = True
|
||||
# Add-on is preliminary approved and nominated for full, so make it
|
||||
# full and not experimental.
|
||||
elif addon.status == amo.STATUS_LITE_AND_NOMINATED:
|
||||
files.filter(status=amo.STATUS_LITE).update(
|
||||
status=amo.STATUS_PUBLIC)
|
||||
files.filter(original_status=amo.STATUS_LITE).update(
|
||||
original_status=amo.STATUS_PUBLIC)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
add_note = True
|
||||
else:
|
||||
add_note = False
|
||||
# Clear up any stray preliminary reviewed versions.
|
||||
files.filter(status=amo.STATUS_LITE).update(
|
||||
status=amo.STATUS_DISABLED)
|
||||
files.filter(original_status=amo.STATUS_LITE).update(
|
||||
original_status=amo.STATUS_DISABLED)
|
||||
|
||||
if add_note:
|
||||
should_email = not addon.is_disabled and addon.is_listed
|
||||
log_args = (addon, addon.latest_or_rejected_version) if (
|
||||
addon.latest_or_rejected_version) else (addon,)
|
||||
log_kwargs = {
|
||||
'user': UserProfile.objects.get(pk=settings.TASK_USER_ID),
|
||||
'details': {
|
||||
'email': should_email,
|
||||
'comments': 'Add-on migrated from preliminary reviewed,'
|
||||
'take care when reviewing.'}}
|
||||
amo.log(
|
||||
amo.LOG.PRELIMINARY_ADDON_MIGRATED, *log_args, **log_kwargs)
|
||||
if should_email:
|
||||
ids_to_email.append('%s' % addon.id)
|
||||
log.info('Add-ons that need to be email notified: [%s]' % (
|
||||
','.join(ids_to_email),))
|
||||
|
|
|
@ -93,11 +93,6 @@
|
|||
This add-on has not been reviewed by Mozilla.
|
||||
<a href="{{ url }}">Learn more</a>
|
||||
{% endtrans %} </p>
|
||||
{% elif b.lite %}
|
||||
<p class="warning">{% trans url=url('pages.faq') + "#preliminary" %}
|
||||
This add-on has been preliminarily reviewed by Mozilla.
|
||||
<a href="{{ url }}">Learn more</a>
|
||||
{% endtrans %} </p>
|
||||
{% elif b.experimental %}
|
||||
<p class="warning">{% trans url=url('pages.faq') + "#experimental" %}
|
||||
This add-on has been marked as experimental by its developers.
|
||||
|
|
|
@ -56,11 +56,6 @@
|
|||
<a href="{{ url }}">Learn more</a>
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% elif b.lite %}
|
||||
<p class="warning">{% trans url=url('pages.faq') + "#preliminary" %}
|
||||
This add-on has been preliminarily reviewed by Mozilla.
|
||||
<a href="{{ url }}">Learn more</a>
|
||||
{% endtrans %} </p>
|
||||
{% elif b.experimental %}
|
||||
<p class="warning">{% trans url=url('pages.faq') + "#experimental" %}
|
||||
This add-on has been marked as experimental by its developers
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{% block bodyclass %}gutter addon-details {{ super() }}{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
{% if settings.ENGAGE_ROBOTS and addon.status == amo.STATUS_UNREVIEWED %}
|
||||
{% if settings.ENGAGE_ROBOTS and addon.status == amo.STATUS_NOMINATED %}
|
||||
<meta name="robots" content="noindex">
|
||||
{% endif %}
|
||||
<meta property="og:title" content="{{ addon.name }}">
|
||||
|
|
|
@ -39,7 +39,6 @@ class ButtonTest(TestCase):
|
|||
v.compat_override_app_versions.return_value = []
|
||||
v.is_unreviewed = False
|
||||
v.is_beta = False
|
||||
v.is_lite = False
|
||||
v.version = 'v1'
|
||||
self.addon.current_version = v
|
||||
|
||||
|
@ -51,7 +50,6 @@ class ButtonTest(TestCase):
|
|||
v.compat_override_app_versions.return_value = []
|
||||
v.is_unreviewed = False
|
||||
v.is_beta = True
|
||||
v.is_lite = False
|
||||
v.version = 'v2-beta'
|
||||
self.addon.current_beta_version = v
|
||||
|
||||
|
@ -251,56 +249,6 @@ class TestButton(ButtonTest):
|
|||
assert b.install_class == ['unreviewed', 'beta']
|
||||
assert b.install_text == 'Not Reviewed'
|
||||
|
||||
def test_lite(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_lite = True
|
||||
b = self.get_button()
|
||||
assert not b.featured
|
||||
assert b.lite
|
||||
assert b.button_class == ['caution']
|
||||
assert b.install_class == ['lite']
|
||||
assert b.install_text == 'Experimental'
|
||||
|
||||
def test_lite_and_nominated(self):
|
||||
# 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
|
||||
assert b.button_class == ['caution']
|
||||
assert b.install_class == ['lite']
|
||||
assert 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
|
||||
assert b.button_class == ['download', 'caution']
|
||||
assert b.install_class == ['unreviewed']
|
||||
assert 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
|
||||
assert b.button_class == ['caution']
|
||||
assert b.install_class == ['lite']
|
||||
assert b.install_text == 'Experimental'
|
||||
|
||||
def test_experimental(self):
|
||||
# Throw featured in there to make sure it's ignored.
|
||||
self.addon.is_featured.return_value = True
|
||||
|
@ -362,7 +310,7 @@ class TestButton(ButtonTest):
|
|||
|
||||
def test_file_details_unreviewed(self):
|
||||
file = self.get_file(amo.PLATFORM_ALL.id)
|
||||
file.status = amo.STATUS_UNREVIEWED
|
||||
file.status = amo.STATUS_AWAITING_REVIEW
|
||||
b = self.get_button()
|
||||
|
||||
_, url, _ = b.file_details(file)
|
||||
|
@ -444,14 +392,6 @@ class TestButtonHtml(ButtonTest):
|
|||
doc('.install').attr('class').split())
|
||||
assert 'Featured' == doc('.install strong:last-child').text()
|
||||
|
||||
def test_unreviewed(self):
|
||||
self.addon.status = amo.STATUS_UNREVIEWED
|
||||
self.addon.is_unreviewed.return_value = True
|
||||
self.addon.get_url_path.return_value = 'addon.url'
|
||||
button = self.render()('.button.caution')
|
||||
assert 'addon.url' == button.attr('href')
|
||||
assert 'xpi.url' == button.attr('data-realurl')
|
||||
|
||||
def test_detailed_privacy_policy(self):
|
||||
policy = self.render(detailed=True)('.install-shell .privacy-policy')
|
||||
assert policy.length == 0
|
||||
|
@ -460,30 +400,6 @@ class TestButtonHtml(ButtonTest):
|
|||
policy = self.render(detailed=True)('.install-shell .privacy-policy')
|
||||
assert policy.text() == 'View privacy policy'
|
||||
|
||||
def test_unreviewed_detailed_warning(self):
|
||||
self.addon.status = amo.STATUS_UNREVIEWED
|
||||
self.addon.is_unreviewed.return_value = True
|
||||
self.addon.get_url_path.return_value = 'addon.url'
|
||||
warning = self.render(detailed=True)('.install-shell .warning')
|
||||
assert warning.text() == (
|
||||
'This add-on has not been reviewed by Mozilla. Learn more')
|
||||
|
||||
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')
|
||||
assert 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')
|
||||
assert warning.text() == (
|
||||
'This add-on has been preliminarily reviewed by Mozilla.'
|
||||
' Learn more')
|
||||
|
||||
def test_experimental_detailed_warning(self):
|
||||
self.addon.status = amo.STATUS_PUBLIC
|
||||
self.addon.is_experimental = True
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import StringIO
|
||||
from datetime import datetime, timedelta
|
||||
import mock
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
|
@ -10,11 +7,9 @@ from django.core.files.storage import default_storage as storage
|
|||
from olympia import amo
|
||||
from olympia.addons.management.commands import approve_addons
|
||||
from olympia.addons.models import AddonFeatureCompatibility
|
||||
from olympia.addons.tasks import migrate_preliminary_to_full
|
||||
from olympia.amo.tests import addon_factory, AMOPaths, version_factory
|
||||
from olympia.amo.tests import addon_factory, AMOPaths
|
||||
from olympia.devhub.models import AddonLog
|
||||
from olympia.editors.models import ReviewerScore
|
||||
from olympia.versions.models import Version
|
||||
|
||||
|
||||
# Where to monkeypatch "lib.crypto.tasks.sign_addons" so it's correctly mocked.
|
||||
|
@ -25,11 +20,9 @@ SIGN_ADDONS = 'olympia.addons.management.commands.sign_addons.sign_addons'
|
|||
|
||||
def test_no_overridden_settings(monkeypatch):
|
||||
assert not settings.SIGNING_SERVER
|
||||
assert not settings.PRELIMINARY_SIGNING_SERVER
|
||||
|
||||
def no_endpoint(ids, **kwargs):
|
||||
assert not settings.SIGNING_SERVER
|
||||
assert not settings.PRELIMINARY_SIGNING_SERVER
|
||||
|
||||
monkeypatch.setattr(SIGN_ADDONS, no_endpoint)
|
||||
call_command('sign_addons', 123)
|
||||
|
@ -46,18 +39,6 @@ def test_override_SIGNING_SERVER_setting(monkeypatch):
|
|||
call_command('sign_addons', 123, signing_server='http://example.com')
|
||||
|
||||
|
||||
def test_override_PRELIMINARY_SIGNING_SERVER_setting(monkeypatch):
|
||||
"""You can override the PRELIMINARY_SIGNING_SERVER settings."""
|
||||
assert not settings.PRELIMINARY_SIGNING_SERVER
|
||||
|
||||
def preliminary_signing_server(ids, **kwargs):
|
||||
assert settings.PRELIMINARY_SIGNING_SERVER == 'http://example.com'
|
||||
|
||||
monkeypatch.setattr(SIGN_ADDONS, preliminary_signing_server)
|
||||
call_command('sign_addons', 123,
|
||||
preliminary_signing_server='http://example.com')
|
||||
|
||||
|
||||
def test_force_signing(monkeypatch):
|
||||
"""You can force signing an addon even if it's already signed."""
|
||||
def not_forced(ids, force, reason):
|
||||
|
@ -91,13 +72,13 @@ def test_approve_addons_get_files_incomplete():
|
|||
@pytest.mark.django_db
|
||||
def test_approve_addons_get_files_bad_guid():
|
||||
"""An add-on with another guid doesn't get approved."""
|
||||
addon1 = addon_factory(status=amo.STATUS_UNREVIEWED, guid='foo')
|
||||
addon1 = addon_factory(status=amo.STATUS_NOMINATED, guid='foo')
|
||||
addon1_file = addon1.latest_version.files.get()
|
||||
addon1_file.update(status=amo.STATUS_UNREVIEWED)
|
||||
addon1_file.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
# Create another add-on that we won't get the files for.
|
||||
addon2 = addon_factory(status=amo.STATUS_UNREVIEWED, guid='bar')
|
||||
addon2 = addon_factory(status=amo.STATUS_NOMINATED, guid='bar')
|
||||
addon2_file = addon2.latest_version.files.get()
|
||||
addon2_file.update(status=amo.STATUS_UNREVIEWED)
|
||||
addon2_file.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
# There's only the addon1's file returned, no other.
|
||||
assert approve_addons.get_files(['foo']) == [addon1_file]
|
||||
|
||||
|
@ -121,8 +102,8 @@ def id_function(fixture_value):
|
|||
|
||||
|
||||
@pytest.fixture(
|
||||
params=[(amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED, 'full'),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED, 'full')],
|
||||
params=[(amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW, 'full'),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW, 'full')],
|
||||
# ids are used to build better names for the tests using this fixture.
|
||||
ids=id_function)
|
||||
def use_case(request, db):
|
||||
|
@ -225,7 +206,7 @@ def test_populate_e10s_feature_compatibility():
|
|||
# Create addons...
|
||||
# One must have no latest file object.
|
||||
addon_unreviewed = addon_factory(
|
||||
name='no current version', status=amo.STATUS_UNREVIEWED)
|
||||
name='no current version', status=amo.STATUS_NOMINATED)
|
||||
addon_unreviewed.update(_current_version=None)
|
||||
assert addon_unreviewed.get_latest_file() is None
|
||||
|
||||
|
@ -299,93 +280,3 @@ def test_populate_e10s_feature_compatibility_with_unlisted():
|
|||
assert addon_compatible_unlisted.feature_compatibility.pk
|
||||
assert (addon_compatible_unlisted.feature_compatibility.e10s ==
|
||||
amo.E10S_COMPATIBLE_WEBEXTENSION)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@mock.patch('olympia.addons.tasks.log')
|
||||
@pytest.mark.parametrize(
|
||||
'pre_addon_status, pre_file1_status, pre_file3_status, enabled, listed, '
|
||||
'end_addon_status, end_file1_status, end_file3_status, end_experimental, '
|
||||
'added_note, send_email',
|
||||
[(amo.STATUS_LITE, amo.STATUS_LITE, amo.STATUS_LITE, True, True,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, True,
|
||||
True, True),
|
||||
|
||||
(amo.STATUS_LITE, amo.STATUS_LITE, amo.STATUS_LITE, False, True,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, True,
|
||||
True, False),
|
||||
|
||||
(amo.STATUS_LITE, amo.STATUS_LITE, amo.STATUS_LITE, True, False,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, True,
|
||||
True, False),
|
||||
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED, True,
|
||||
True,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED, True,
|
||||
True, True),
|
||||
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED, False,
|
||||
True,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED, True,
|
||||
True, False),
|
||||
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE, amo.STATUS_LITE, True,
|
||||
True,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, False,
|
||||
True, True),
|
||||
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE, amo.STATUS_UNREVIEWED,
|
||||
True, True,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED, False,
|
||||
True, True),
|
||||
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_LITE, amo.STATUS_PUBLIC, True, True,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_DISABLED, amo.STATUS_PUBLIC, False,
|
||||
False, False)])
|
||||
def test_migrate_preliminary(
|
||||
logger_mock,
|
||||
pre_addon_status, pre_file1_status, pre_file3_status, enabled, listed,
|
||||
end_addon_status, end_file1_status, end_file3_status, end_experimental,
|
||||
added_note, send_email, mozilla_user):
|
||||
"""Addons and versions are migrated correctly."""
|
||||
an_hour_ago = datetime.now() - timedelta(hours=1)
|
||||
addon = addon_factory(status=pre_addon_status, is_listed=listed,
|
||||
version_kw={'version': '1', 'created': an_hour_ago},
|
||||
file_kw={'status': pre_file1_status})
|
||||
# Add a disabled version to test original_status
|
||||
version_factory(addon=addon, version='2', file_kw={
|
||||
'status': amo.STATUS_DISABLED, 'original_status': amo.STATUS_LITE})
|
||||
version = version_factory(addon=addon, version='3',
|
||||
file_kw={'status': pre_file3_status})
|
||||
addon.update(status=pre_addon_status, disabled_by_user=(not enabled))
|
||||
addon.reload()
|
||||
assert addon.latest_version == version
|
||||
assert addon.status == pre_addon_status
|
||||
assert addon.is_experimental is False
|
||||
|
||||
output = StringIO.StringIO()
|
||||
migrate_preliminary_to_full([addon.id], out=output)
|
||||
addon.reload()
|
||||
assert addon.status == end_addon_status
|
||||
assert addon.is_experimental == end_experimental
|
||||
# Check v1's status matches
|
||||
v1 = Version.objects.filter(addon=addon, version='1')[0]
|
||||
assert v1.all_files[0].status == end_file1_status
|
||||
# Now check original_status worked too
|
||||
v2 = Version.objects.filter(addon=addon, version='2')[0]
|
||||
if pre_addon_status in [amo.STATUS_UNREVIEWED, amo.STATUS_PUBLIC]:
|
||||
assert v2.all_files[0].original_status == amo.STATUS_DISABLED
|
||||
else:
|
||||
assert v2.all_files[0].original_status == amo.STATUS_PUBLIC
|
||||
# Lastly check the latest version, v3
|
||||
assert addon.latest_version.all_files[0].status == end_file3_status
|
||||
assert addon.disabled_by_user == (not enabled)
|
||||
if added_note:
|
||||
logs = AddonLog.objects.filter(
|
||||
addon=addon,
|
||||
activity_log__action=amo.LOG.PRELIMINARY_ADDON_MIGRATED.id)
|
||||
assert len(logs) == 1
|
||||
assert logs[0].activity_log.details['email'] == send_email
|
||||
if send_email:
|
||||
log_string = 'Add-ons that need to be email notified: [%s]' % addon.id
|
||||
logger_mock.info.assert_called_with(log_string)
|
||||
|
|
|
@ -51,26 +51,6 @@ class TestLastUpdated(TestCase):
|
|||
for addon in Addon.objects.filter(status=amo.STATUS_PUBLIC):
|
||||
assert addon.last_updated == addon.created
|
||||
|
||||
def test_last_updated_lite(self):
|
||||
# Make sure lite addons' last_updated matches their file's
|
||||
# datestatuschanged.
|
||||
Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
|
||||
File.objects.update(status=amo.STATUS_LITE)
|
||||
cron.addon_last_updated()
|
||||
addon = Addon.objects.get(id=3615)
|
||||
files = File.objects.filter(version__addon=addon)
|
||||
assert len(files) == 1
|
||||
assert addon.last_updated == files[0].datestatuschanged
|
||||
assert addon.last_updated
|
||||
|
||||
def test_last_update_lite_no_files(self):
|
||||
Addon.objects.update(status=amo.STATUS_LITE, last_updated=None)
|
||||
File.objects.update(status=amo.STATUS_UNREVIEWED)
|
||||
cron.addon_last_updated()
|
||||
addon = Addon.objects.get(id=3615)
|
||||
assert addon.last_updated == addon.created
|
||||
assert addon.last_updated
|
||||
|
||||
def test_appsupport(self):
|
||||
ids = Addon.objects.values_list('id', flat=True)
|
||||
cron._update_appsupport(ids)
|
||||
|
@ -112,13 +92,9 @@ class TestHideDisabledFiles(TestCase):
|
|||
@mock.patch('olympia.files.models.os')
|
||||
def test_leave_nondisabled_files(self, os_mock):
|
||||
# All these addon/file status pairs should stay.
|
||||
stati = [(amo.STATUS_PUBLIC, amo.STATUS_PUBLIC),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_BETA),
|
||||
(amo.STATUS_LITE, amo.STATUS_UNREVIEWED),
|
||||
(amo.STATUS_LITE, amo.STATUS_LITE),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_UNREVIEWED),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE)]
|
||||
stati = ((amo.STATUS_PUBLIC, amo.STATUS_PUBLIC),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_BETA))
|
||||
for addon_status, file_status in stati:
|
||||
self.addon.update(status=addon_status)
|
||||
File.objects.update(status=file_status)
|
||||
|
@ -175,9 +151,10 @@ class TestHideDisabledFiles(TestCase):
|
|||
@mock.patch('olympia.files.models.File.mv')
|
||||
@mock.patch('olympia.files.models.storage')
|
||||
def test_move_disabled_file(self, m_storage, mv_mock):
|
||||
Addon.objects.filter(id=self.addon.id).update(status=amo.STATUS_LITE)
|
||||
Addon.objects.filter(id=self.addon.id).update(status=amo.STATUS_PUBLIC)
|
||||
File.objects.filter(id=self.f1.id).update(status=amo.STATUS_DISABLED)
|
||||
File.objects.filter(id=self.f2.id).update(status=amo.STATUS_UNREVIEWED)
|
||||
File.objects.filter(id=self.f2.id).update(
|
||||
status=amo.STATUS_AWAITING_REVIEW)
|
||||
cron.hide_disabled_files()
|
||||
# Only f1 should have been moved.
|
||||
f1 = self.f1
|
||||
|
@ -205,13 +182,13 @@ class TestUnhideDisabledFiles(TestCase):
|
|||
cron.unhide_disabled_files()
|
||||
assert not os_mock.path.exists.called
|
||||
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
self.addon.update(status=amo.STATUS_PUBLIC)
|
||||
self.file_.update(status=amo.STATUS_DISABLED)
|
||||
cron.unhide_disabled_files()
|
||||
assert not os_mock.path.exists.called
|
||||
|
||||
self.addon.update(disabled_by_user=True)
|
||||
self.file_.update(status=amo.STATUS_LITE)
|
||||
self.file_.update(status=amo.STATUS_PUBLIC)
|
||||
cron.unhide_disabled_files()
|
||||
assert not os_mock.path.exists.called
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class TestHelpers(TestCase):
|
|||
ctx = {'APP': amo.FIREFOX, 'LANG': 'en-US'}
|
||||
|
||||
# unreviewed
|
||||
a = Addon(status=amo.STATUS_UNREVIEWED)
|
||||
a = Addon(status=amo.STATUS_NOMINATED)
|
||||
assert statusflags(ctx, a) == 'unreviewed'
|
||||
|
||||
# featured
|
||||
|
@ -33,7 +33,7 @@ class TestHelpers(TestCase):
|
|||
ctx = {'APP': amo.FIREFOX, 'LANG': 'en-US'}
|
||||
|
||||
# unreviewed
|
||||
a = Addon(status=amo.STATUS_UNREVIEWED)
|
||||
a = Addon(status=amo.STATUS_NOMINATED)
|
||||
assert flag(ctx, a) == '<h5 class="flag">Not Reviewed</h5>'
|
||||
|
||||
# featured
|
||||
|
|
|
@ -249,11 +249,11 @@ class TestAddonManager(TestCase):
|
|||
|
||||
# If we search for public or unreviewed we find it.
|
||||
addon.disabled_by_user = False
|
||||
addon.status = amo.STATUS_UNREVIEWED
|
||||
addon.status = amo.STATUS_NOMINATED
|
||||
addon.save()
|
||||
assert q.count() == 3
|
||||
assert Addon.objects.listed(amo.FIREFOX, amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED).count() == 4
|
||||
amo.STATUS_NOMINATED).count() == 4
|
||||
|
||||
# Can't find it without a file.
|
||||
addon.versions.get().files.get().delete()
|
||||
|
@ -275,7 +275,7 @@ class TestAddonManager(TestCase):
|
|||
exp = Addon.objects.unreviewed()
|
||||
|
||||
for addon in exp:
|
||||
assert addon.status in amo.UNREVIEWED_STATUSES, (
|
||||
assert addon.status in amo.UNREVIEWED_ADDON_STATUSES, (
|
||||
'unreviewed() must return unreviewed addons.')
|
||||
|
||||
def test_valid(self):
|
||||
|
@ -284,7 +284,7 @@ class TestAddonManager(TestCase):
|
|||
objs = Addon.objects.valid()
|
||||
|
||||
for addon in objs:
|
||||
assert addon.status in amo.LISTED_STATUSES
|
||||
assert addon.status in amo.VALID_ADDON_STATUSES
|
||||
assert not addon.disabled_by_user
|
||||
|
||||
def test_valid_disabled_by_user(self):
|
||||
|
@ -509,19 +509,6 @@ class TestAddonModels(TestCase):
|
|||
|
||||
assert a.compatible_version(amo.FIREFOX.id) == v
|
||||
|
||||
def test_compatible_version_status(self):
|
||||
"""
|
||||
Tests that `compatible_version()` won't return a lited version for a
|
||||
fully-reviewed add-on.
|
||||
"""
|
||||
a = Addon.objects.get(pk=3615)
|
||||
assert a.status == amo.STATUS_PUBLIC
|
||||
|
||||
v = self._create_new_version(addon=a, status=amo.STATUS_LITE)
|
||||
|
||||
assert a.current_version != v
|
||||
assert a.compatible_version(amo.FIREFOX.id) == a.current_version
|
||||
|
||||
def test_transformer(self):
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
# If the transformer works then we won't have any more queries.
|
||||
|
@ -685,11 +672,7 @@ class TestAddonModels(TestCase):
|
|||
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
|
||||
a.status = amo.STATUS_NOMINATED
|
||||
assert a.is_unreviewed(), 'pending add-on: is_unreviewed=True'
|
||||
|
||||
def test_is_public(self):
|
||||
|
@ -702,21 +685,6 @@ class TestAddonModels(TestCase):
|
|||
assert not a.is_public(), (
|
||||
'public, disabled add-on should not be is_public()')
|
||||
|
||||
# Lite add-on.
|
||||
a.status = amo.STATUS_LITE
|
||||
a.disabled_by_user = False
|
||||
assert not a.is_public(), 'lite add-on should not be is_public()'
|
||||
|
||||
# Unreviewed add-on.
|
||||
a.status = amo.STATUS_UNREVIEWED
|
||||
assert not a.is_public(), 'unreviewed add-on should not be is_public()'
|
||||
|
||||
# Unreviewed, disabled add-on.
|
||||
a.status = amo.STATUS_UNREVIEWED
|
||||
a.disabled_by_user = True
|
||||
assert not a.is_public(), (
|
||||
'unreviewed, disabled add-on should not be is_public()')
|
||||
|
||||
def test_is_reviewed(self):
|
||||
# Public add-on.
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
|
@ -727,18 +695,6 @@ class TestAddonModels(TestCase):
|
|||
addon.disabled_by_user = True
|
||||
assert addon.is_reviewed() # It's still considered "reviewed".
|
||||
|
||||
# Preliminarily Reviewed.
|
||||
addon.status = amo.STATUS_LITE
|
||||
assert addon.is_reviewed()
|
||||
|
||||
# Preliminarily Reviewed and Awaiting Full Review.
|
||||
addon.status = amo.STATUS_LITE_AND_NOMINATED
|
||||
assert addon.is_reviewed()
|
||||
|
||||
# Unreviewed add-on.
|
||||
addon.status = amo.STATUS_UNREVIEWED
|
||||
assert not addon.is_reviewed()
|
||||
|
||||
def test_requires_restart(self):
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
file_ = addon.current_version.all_files[0]
|
||||
|
@ -1195,7 +1151,7 @@ class TestAddonModels(TestCase):
|
|||
paypal_id='$$')
|
||||
assert a.takes_contributions
|
||||
|
||||
a.status = amo.STATUS_UNREVIEWED
|
||||
a.status = amo.STATUS_NOMINATED
|
||||
assert not a.takes_contributions
|
||||
a.status = amo.STATUS_PUBLIC
|
||||
|
||||
|
@ -1222,7 +1178,7 @@ class TestAddonModels(TestCase):
|
|||
assert a.show_beta
|
||||
|
||||
# We have a beta version but status has to be public.
|
||||
a.status = amo.STATUS_UNREVIEWED
|
||||
a.status = amo.STATUS_NOMINATED
|
||||
assert not a.show_beta
|
||||
|
||||
def test_update_logs(self):
|
||||
|
@ -1240,7 +1196,7 @@ class TestAddonModels(TestCase):
|
|||
return addon, version
|
||||
|
||||
def test_no_change_disabled_user(self):
|
||||
addon, version = self.setup_files(amo.STATUS_UNREVIEWED)
|
||||
addon, version = self.setup_files(amo.STATUS_AWAITING_REVIEW)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
addon.update(disabled_by_user=True)
|
||||
version.save()
|
||||
|
@ -1263,24 +1219,12 @@ class TestAddonModels(TestCase):
|
|||
assert addon.status == amo.STATUS_DELETED
|
||||
assert addon.is_deleted
|
||||
|
||||
def test_can_alter_in_prelim(self):
|
||||
addon, version = self.setup_files(amo.STATUS_LITE)
|
||||
addon.update(status=amo.STATUS_LITE)
|
||||
version.save()
|
||||
assert addon.status == amo.STATUS_LITE
|
||||
|
||||
def test_removing_public(self):
|
||||
addon, version = self.setup_files(amo.STATUS_UNREVIEWED)
|
||||
addon, version = self.setup_files(amo.STATUS_AWAITING_REVIEW)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
version.save()
|
||||
assert addon.status == amo.STATUS_NOMINATED
|
||||
|
||||
def test_removing_public_with_prelim(self):
|
||||
addon, version = self.setup_files(amo.STATUS_LITE)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
version.save()
|
||||
assert addon.status == amo.STATUS_LITE
|
||||
|
||||
def test_can_request_review_no_files(self):
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
addon.versions.all()[0].files.all().delete()
|
||||
|
@ -1291,28 +1235,24 @@ class TestAddonModels(TestCase):
|
|||
addon.latest_version.files.update(status=amo.STATUS_DISABLED)
|
||||
assert addon.can_request_review() == ()
|
||||
|
||||
def check(self, status, expected, disallow_preliminary=False,
|
||||
extra_update_kw=None):
|
||||
def check(self, status, expected, extra_update_kw=None):
|
||||
if extra_update_kw is None:
|
||||
extra_update_kw = {}
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
changes = {'status': status, 'disabled_by_user': False}
|
||||
changes.update(**extra_update_kw)
|
||||
addon.update(**changes)
|
||||
assert addon.can_request_review(disallow_preliminary) == expected
|
||||
assert addon.can_request_review() == expected
|
||||
|
||||
def test_can_request_review_null(self):
|
||||
self.check(amo.STATUS_NULL, (amo.STATUS_LITE, amo.STATUS_PUBLIC))
|
||||
self.check(amo.STATUS_NULL, (amo.STATUS_PUBLIC,))
|
||||
|
||||
def test_can_request_review_null_disabled(self):
|
||||
self.check(amo.STATUS_NULL, (),
|
||||
extra_update_kw={'disabled_by_user': True})
|
||||
|
||||
def test_can_request_review_unreviewed(self):
|
||||
self.check(amo.STATUS_UNREVIEWED, (amo.STATUS_PUBLIC,))
|
||||
|
||||
def test_can_request_review_nominated(self):
|
||||
self.check(amo.STATUS_NOMINATED, (amo.STATUS_LITE,))
|
||||
self.check(amo.STATUS_NOMINATED, ())
|
||||
|
||||
def test_can_request_review_public(self):
|
||||
self.check(amo.STATUS_PUBLIC, ())
|
||||
|
@ -1323,44 +1263,6 @@ class TestAddonModels(TestCase):
|
|||
def test_can_request_review_deleted(self):
|
||||
self.check(amo.STATUS_DELETED, ())
|
||||
|
||||
def test_can_request_review_lite(self):
|
||||
self.check(amo.STATUS_LITE, (amo.STATUS_PUBLIC,))
|
||||
|
||||
def test_can_request_review_lite_and_nominated(self):
|
||||
self.check(amo.STATUS_LITE_AND_NOMINATED, ())
|
||||
|
||||
def test_can_request_review_null_no_prelim(self):
|
||||
self.check(amo.STATUS_NULL, (amo.STATUS_PUBLIC,),
|
||||
disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_null_disabled_no_prelim(self):
|
||||
self.check(amo.STATUS_NULL, (), disallow_preliminary=True,
|
||||
extra_update_kw={'disabled_by_user': True})
|
||||
|
||||
def test_can_request_review_unreviewed_no_prelim(self):
|
||||
self.check(amo.STATUS_UNREVIEWED, (amo.STATUS_PUBLIC,),
|
||||
disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_nominated_no_prelim(self):
|
||||
self.check(amo.STATUS_NOMINATED, (), disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_public_no_prelim(self):
|
||||
self.check(amo.STATUS_PUBLIC, (), disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_disabled_no_prelim(self):
|
||||
self.check(amo.STATUS_DISABLED, (), disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_deleted_no_prelim(self):
|
||||
self.check(amo.STATUS_DELETED, (), disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_lite_no_prelim(self):
|
||||
self.check(amo.STATUS_LITE, (amo.STATUS_PUBLIC,),
|
||||
disallow_preliminary=True)
|
||||
|
||||
def test_can_request_review_lite_and_nominated_no_prelim(self):
|
||||
self.check(amo.STATUS_LITE_AND_NOMINATED, (),
|
||||
disallow_preliminary=True)
|
||||
|
||||
def test_none_homepage(self):
|
||||
# There was an odd error when a translation was set to None.
|
||||
Addon.objects.create(homepage=None, type=amo.ADDON_EXTENSION)
|
||||
|
@ -1477,21 +1379,19 @@ class TestAddonNomination(TestCase):
|
|||
|
||||
def test_set_nomination(self):
|
||||
a = Addon.objects.get(id=3615)
|
||||
for status in amo.UNDER_REVIEW_STATUSES:
|
||||
a.update(status=amo.STATUS_NULL)
|
||||
a.versions.latest().update(nomination=None)
|
||||
a.update(status=status)
|
||||
assert a.versions.latest().nomination
|
||||
a.update(status=amo.STATUS_NULL)
|
||||
a.versions.latest().update(nomination=None)
|
||||
a.update(status=amo.STATUS_NOMINATED)
|
||||
assert a.versions.latest().nomination
|
||||
|
||||
def test_new_version_inherits_nomination(self):
|
||||
a = Addon.objects.get(id=3615)
|
||||
ver = 10
|
||||
for status in amo.UNDER_REVIEW_STATUSES:
|
||||
a.update(status=status)
|
||||
old_ver = a.versions.latest()
|
||||
v = Version.objects.create(addon=a, version=str(ver))
|
||||
assert v.nomination == old_ver.nomination
|
||||
ver += 1
|
||||
a.update(status=amo.STATUS_NOMINATED)
|
||||
old_ver = a.versions.latest()
|
||||
v = Version.objects.create(addon=a, version=str(ver))
|
||||
assert v.nomination == old_ver.nomination
|
||||
ver += 1
|
||||
|
||||
def test_beta_version_does_not_inherit_nomination(self):
|
||||
a = Addon.objects.get(id=3615)
|
||||
|
@ -1534,15 +1434,16 @@ class TestAddonNomination(TestCase):
|
|||
addon.update(status=amo.STATUS_NOMINATED)
|
||||
assert addon.versions.latest().nomination.date() == earlier.date()
|
||||
|
||||
def setup_nomination(self, status=amo.STATUS_UNREVIEWED):
|
||||
def setup_nomination(self, addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_AWAITING_REVIEW):
|
||||
addon = Addon.objects.create()
|
||||
version = Version.objects.create(addon=addon)
|
||||
File.objects.create(status=status, version=version)
|
||||
File.objects.create(status=file_status, version=version)
|
||||
# Cheating date to make sure we don't have a date on the same second
|
||||
# the code we test is running.
|
||||
past = self.days_ago(1)
|
||||
version.update(nomination=past, created=past, modified=past)
|
||||
addon.update(status=status)
|
||||
addon.update(status=addon_status)
|
||||
nomination = addon.versions.latest().nomination
|
||||
assert nomination
|
||||
return addon, nomination
|
||||
|
@ -1550,22 +1451,7 @@ class TestAddonNomination(TestCase):
|
|||
def test_new_version_of_under_review_addon_does_not_reset_nomination(self):
|
||||
addon, nomination = self.setup_nomination()
|
||||
version = Version.objects.create(addon=addon, version='0.2')
|
||||
File.objects.create(status=amo.STATUS_UNREVIEWED, version=version)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
|
||||
def test_nomination_not_reset_if_changing_addon_status(self):
|
||||
"""
|
||||
When under review, switching status should not reset nomination.
|
||||
"""
|
||||
addon, nomination = self.setup_nomination()
|
||||
# Now switch to a full review.
|
||||
addon.update(status=amo.STATUS_NOMINATED)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
# Then again to a preliminary.
|
||||
addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
# Finally back to a reviewed status.
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
File.objects.create(status=amo.STATUS_AWAITING_REVIEW, version=version)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
|
||||
def test_nomination_not_reset_if_adding_new_versions_and_files(self):
|
||||
|
@ -1580,30 +1466,22 @@ class TestAddonNomination(TestCase):
|
|||
assert addon.versions.latest().nomination == nomination
|
||||
# Adding a new unreviewed version.
|
||||
version = Version.objects.create(addon=addon, version="0.2")
|
||||
File.objects.create(status=amo.STATUS_UNREVIEWED, version=version)
|
||||
File.objects.create(status=amo.STATUS_AWAITING_REVIEW, version=version)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
# Adding a new unreviewed version.
|
||||
version = Version.objects.create(addon=addon, version="0.3")
|
||||
File.objects.create(status=amo.STATUS_NOMINATED, version=version)
|
||||
File.objects.create(status=amo.STATUS_AWAITING_REVIEW, version=version)
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
|
||||
def check_nomination_reset_with_new_version(self, addon, nomination):
|
||||
version = Version.objects.create(addon=addon, version="0.2")
|
||||
assert version.nomination is None
|
||||
File.objects.create(status=amo.STATUS_UNREVIEWED, version=version)
|
||||
File.objects.create(status=amo.STATUS_AWAITING_REVIEW, version=version)
|
||||
assert addon.versions.latest().nomination != nomination
|
||||
|
||||
def test_new_version_of_public_addon_should_reset_nomination(self):
|
||||
addon, nomination = self.setup_nomination(status=amo.STATUS_LITE)
|
||||
# Update again, but without a new version.
|
||||
addon.update(status=amo.STATUS_LITE)
|
||||
# Check that nomination has been reset.
|
||||
assert addon.versions.latest().nomination == nomination
|
||||
# Now create a new version with an attached file, and update status.
|
||||
self.check_nomination_reset_with_new_version(addon, nomination)
|
||||
|
||||
def test_new_version_of_fully_reviewed_addon_should_reset_nomination(self):
|
||||
addon, nomination = self.setup_nomination(status=amo.STATUS_PUBLIC)
|
||||
addon, nomination = self.setup_nomination(
|
||||
addon_status=amo.STATUS_PUBLIC, file_status=amo.STATUS_PUBLIC)
|
||||
# Now create a new version with an attached file, and update status.
|
||||
self.check_nomination_reset_with_new_version(addon, nomination)
|
||||
|
||||
|
@ -1678,10 +1556,10 @@ class TestUpdateStatus(TestCase):
|
|||
|
||||
def test_no_file_ends_with_NULL(self):
|
||||
addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
|
||||
addon.status = amo.STATUS_UNREVIEWED
|
||||
addon.status = amo.STATUS_NOMINATED
|
||||
addon.save()
|
||||
assert Addon.objects.no_cache().get(pk=addon.pk).status == (
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_NOMINATED)
|
||||
Version.objects.create(addon=addon)
|
||||
assert Addon.objects.no_cache().get(pk=addon.pk).status == (
|
||||
amo.STATUS_NULL)
|
||||
|
@ -1689,11 +1567,12 @@ class TestUpdateStatus(TestCase):
|
|||
def test_no_valid_file_ends_with_NULL(self):
|
||||
addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
|
||||
version = Version.objects.create(addon=addon)
|
||||
f = File.objects.create(status=amo.STATUS_UNREVIEWED, version=version)
|
||||
addon.status = amo.STATUS_UNREVIEWED
|
||||
f = File.objects.create(status=amo.STATUS_AWAITING_REVIEW,
|
||||
version=version)
|
||||
addon.status = amo.STATUS_NOMINATED
|
||||
addon.save()
|
||||
assert Addon.objects.no_cache().get(pk=addon.pk).status == (
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_NOMINATED)
|
||||
f.status = amo.STATUS_DISABLED
|
||||
f.save()
|
||||
assert Addon.objects.no_cache().get(pk=addon.pk).status == (
|
||||
|
@ -1713,10 +1592,6 @@ class TestGetVersion(TestCase):
|
|||
File.objects.create(version=version, status=status)
|
||||
return version
|
||||
|
||||
def test_public_new_lite_version(self):
|
||||
self.new_version(amo.STATUS_LITE)
|
||||
assert self.addon.get_version() == self.version
|
||||
|
||||
def test_public_new_nominated_version(self):
|
||||
self.new_version(amo.STATUS_NOMINATED)
|
||||
assert self.addon.get_version() == self.version
|
||||
|
@ -1726,39 +1601,9 @@ class TestGetVersion(TestCase):
|
|||
assert self.addon.get_version() == v
|
||||
|
||||
def test_public_new_unreviewed_version(self):
|
||||
self.new_version(amo.STATUS_UNREVIEWED)
|
||||
self.new_version(amo.STATUS_AWAITING_REVIEW)
|
||||
assert self.addon.get_version() == self.version
|
||||
|
||||
def test_lite_new_unreviewed_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
self.new_version(amo.STATUS_UNREVIEWED)
|
||||
assert self.addon.get_version() == self.version
|
||||
|
||||
def test_lite_new_lan_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
v = self.new_version(amo.STATUS_LITE_AND_NOMINATED)
|
||||
assert self.addon.get_version() == v
|
||||
|
||||
def test_lite_new_lite_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
v = self.new_version(amo.STATUS_LITE)
|
||||
assert self.addon.get_version() == v
|
||||
|
||||
def test_lite_new_full_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
v = self.new_version(amo.STATUS_PUBLIC)
|
||||
assert self.addon.get_version() == v
|
||||
|
||||
def test_lan_new_lite_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
v = self.new_version(amo.STATUS_LITE)
|
||||
assert self.addon.get_version() == v
|
||||
|
||||
def test_lan_new_full_version(self):
|
||||
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
v = self.new_version(amo.STATUS_PUBLIC)
|
||||
assert self.addon.get_version() == v
|
||||
|
||||
def test_should_promote_previous_valid_version_if_latest_is_disabled(self):
|
||||
self.new_version(amo.STATUS_DISABLED)
|
||||
assert self.addon.get_version() == self.version
|
||||
|
@ -2218,7 +2063,7 @@ class TestAddonFromUpload(UploadTest):
|
|||
v = addon.versions.get()
|
||||
assert v.version == '0.1'
|
||||
assert v.files.get().platform == self.platform
|
||||
assert v.files.get().status == amo.STATUS_UNREVIEWED
|
||||
assert v.files.get().status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
def test_xpi_for_multiple_platforms(self):
|
||||
platforms = [amo.PLATFORM_LINUX.id, amo.PLATFORM_MAC.id]
|
||||
|
@ -2246,7 +2091,7 @@ class TestAddonFromUpload(UploadTest):
|
|||
v = addon.versions.get()
|
||||
assert v.version == datetime.now().strftime('%Y%m%d')
|
||||
assert v.files.get().platform == amo.PLATFORM_ALL.id
|
||||
assert v.files.get().status == amo.STATUS_UNREVIEWED
|
||||
assert v.files.get().status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
def test_no_homepage(self):
|
||||
addon = Addon.from_upload(self.get_upload('extension-no-homepage.xpi'),
|
||||
|
|
|
@ -336,70 +336,6 @@ class TestLookup(VersionCheckMixin, TestCase):
|
|||
assert version == self.version_1_2_2
|
||||
assert file == file_two.pk
|
||||
|
||||
def test_file_preliminary(self):
|
||||
"""
|
||||
If there's a newer file in prelim. review it won't show up. This is
|
||||
a test for https://bugzilla.mozilla.org/show_bug.cgi?id=620749
|
||||
"""
|
||||
version = Version.objects.get(pk=self.version_1_2_2)
|
||||
file = version.files.all()[0]
|
||||
file.status = amo.STATUS_LITE
|
||||
file.save()
|
||||
|
||||
version, file = self.get('1.2', self.version_int,
|
||||
self.app, amo.PLATFORM_LINUX)
|
||||
assert version == self.version_1_2_1
|
||||
|
||||
def test_file_preliminary_addon(self):
|
||||
"""
|
||||
If the addon is in prelim. review, show the highest file with
|
||||
prelim, which in this case is 1.2.1
|
||||
"""
|
||||
for status in amo.LITE_STATUSES:
|
||||
self.addon.update(status=status)
|
||||
|
||||
# Since we're asking for an update from version 1.2, and
|
||||
# we want to serve a prelim update, 1.2 needs to be
|
||||
# prelim as well.
|
||||
self.change_status(self.version_1_2_0, amo.STATUS_LITE)
|
||||
self.change_status(self.version_1_2_1, amo.STATUS_LITE)
|
||||
version, file = self.get('1.2', self.version_int,
|
||||
self.app, amo.PLATFORM_LINUX)
|
||||
assert version == self.version_1_2_1
|
||||
|
||||
def test_file_preliminary_odd_statuses(self):
|
||||
"""
|
||||
Test that we serve prelim updates even when current version is
|
||||
disabled or deleted.
|
||||
"""
|
||||
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
self.change_status(self.version_1_2_1, amo.STATUS_LITE)
|
||||
|
||||
# Current version disabled.
|
||||
self.change_status(self.version_1_2_0, amo.STATUS_DISABLED)
|
||||
version, file = self.get('1.2', self.version_int,
|
||||
self.app, amo.PLATFORM_LINUX)
|
||||
assert version == self.version_1_2_1
|
||||
|
||||
# Current version deleted.
|
||||
Version.objects.get(pk=self.version_1_2_0).delete()
|
||||
version, file = self.get('1.2', self.version_int,
|
||||
self.app, amo.PLATFORM_LINUX)
|
||||
assert version == self.version_1_2_1
|
||||
|
||||
def test_file_preliminary_ex_full_addon(self):
|
||||
"""
|
||||
If the addon is in prelim. review, user has a full reviewed version.
|
||||
Show the most recent full reviewed version.
|
||||
"""
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
|
||||
self.change_status(self.version_1_2_2, amo.STATUS_LITE)
|
||||
version, file = self.get('1.2', self.version_int,
|
||||
self.app, amo.PLATFORM_LINUX)
|
||||
assert version == self.version_1_2_1
|
||||
|
||||
|
||||
class TestDefaultToCompat(VersionCheckMixin, TestCase):
|
||||
"""
|
||||
|
|
|
@ -127,7 +127,7 @@ class TestHomepageFeatures(TestCase):
|
|||
addon_lists = 'popular featured hotness personas'.split()
|
||||
for key in addon_lists:
|
||||
for addon in response.context[key]:
|
||||
assert addon.status != amo.STATUS_UNREVIEWED
|
||||
assert addon.status != amo.STATUS_NOMINATED
|
||||
|
||||
def test_seeall(self):
|
||||
Collection.objects.update(type=amo.COLLECTION_FEATURED)
|
||||
|
@ -614,7 +614,7 @@ class TestDetailPage(TestCase):
|
|||
doc = pq(self.client.get(url).content)
|
||||
assert doc(m)
|
||||
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
settings.ENGAGE_ROBOTS = False
|
||||
doc = pq(self.client.get(url).content)
|
||||
assert doc(m)
|
||||
|
@ -641,11 +641,10 @@ class TestDetailPage(TestCase):
|
|||
return pq(self.client.get(self.url, follow=True).content)
|
||||
|
||||
# Add a beta version and show it.
|
||||
mybetafile = self.addon.versions.all()[0].files.all()[0]
|
||||
mybetafile.status = amo.STATUS_BETA
|
||||
mybetafile.save()
|
||||
version_factory(file_kw={'status': amo.STATUS_BETA}, addon=self.addon)
|
||||
self.addon.update(status=amo.STATUS_PUBLIC)
|
||||
beta = get_pq_content()
|
||||
assert self.addon.reload().status == amo.STATUS_PUBLIC
|
||||
assert beta('#beta-channel').length == 1
|
||||
|
||||
# Beta channel section should link to beta versions listing
|
||||
|
@ -654,13 +653,13 @@ class TestDetailPage(TestCase):
|
|||
assert beta('#beta-channel a.more-info').attr('href') == versions_url
|
||||
|
||||
# Now hide it. Beta is only shown for STATUS_PUBLIC.
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
beta = get_pq_content()
|
||||
assert beta('#beta-channel').length == 0
|
||||
|
||||
@amo.tests.mobile_test
|
||||
def test_unreviewed_disabled_button(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
r = self.client.get(self.url)
|
||||
doc = pq(r.content)
|
||||
assert doc('.button.add').length == 1
|
||||
|
@ -1048,7 +1047,7 @@ class TestImpalaDetailPage(TestCase):
|
|||
def test_other_addons_no_unlisted(self):
|
||||
"""An unlisted add-on by the same author should not show up."""
|
||||
other = Addon.objects.get(id=592)
|
||||
other.update(status=amo.STATUS_UNREVIEWED, disabled_by_user=True)
|
||||
other.update(status=amo.STATUS_NOMINATED, disabled_by_user=True)
|
||||
|
||||
add_addon_author(other, self.addon)
|
||||
assert self.get_more_pq()('#author-addons').length == 0
|
||||
|
@ -1122,7 +1121,7 @@ class TestPersonaDetailPage(TestPersonas, TestCase):
|
|||
def test_other_personas(self):
|
||||
"""Ensure listed personas by the same author show up."""
|
||||
addon_factory(type=amo.ADDON_PERSONA, status=amo.STATUS_NULL)
|
||||
addon_factory(type=amo.ADDON_PERSONA, status=amo.STATUS_LITE)
|
||||
addon_factory(type=amo.ADDON_PERSONA, status=amo.STATUS_PUBLIC)
|
||||
addon_factory(type=amo.ADDON_PERSONA, disabled_by_user=True)
|
||||
|
||||
other = addon_factory(type=amo.ADDON_PERSONA)
|
||||
|
@ -1172,10 +1171,6 @@ class TestStatus(TestCase):
|
|||
self.addon.update(status=amo.STATUS_NULL)
|
||||
assert self.client.get(self.url).status_code == 404
|
||||
|
||||
def test_unreviewed(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
assert self.client.get(self.url).status_code == 200
|
||||
|
||||
def test_pending(self):
|
||||
self.addon.update(status=amo.STATUS_PENDING)
|
||||
assert self.client.get(self.url).status_code == 404
|
||||
|
@ -1196,14 +1191,6 @@ class TestStatus(TestCase):
|
|||
self.addon.update(status=amo.STATUS_DISABLED)
|
||||
assert self.client.get(self.url).status_code == 404
|
||||
|
||||
def test_lite(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
assert self.client.get(self.url).status_code == 200
|
||||
|
||||
def test_lite_and_nominated(self):
|
||||
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
assert self.client.get(self.url).status_code == 200
|
||||
|
||||
def test_disabled_by_user(self):
|
||||
self.addon.update(disabled_by_user=True)
|
||||
assert self.client.get(self.url).status_code == 404
|
||||
|
@ -1599,28 +1586,20 @@ class AddonAndVersionViewSetDetailMixin(object):
|
|||
self._set_tested_url(self.addon.guid)
|
||||
self._test_url()
|
||||
|
||||
def test_get_lite_status(self):
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
self._test_url()
|
||||
|
||||
def test_get_lite_and_nominated_status(self):
|
||||
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
self._test_url()
|
||||
|
||||
def test_get_not_public_anonymous(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
response = self.client.get(self.url)
|
||||
assert response.status_code == 401
|
||||
|
||||
def test_get_not_public_no_rights(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
user = UserProfile.objects.create(username='simpleuser')
|
||||
self.client.login_api(user)
|
||||
response = self.client.get(self.url)
|
||||
assert response.status_code == 403
|
||||
|
||||
def test_get_not_public_reviewer(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
user = UserProfile.objects.create(username='reviewer')
|
||||
self.grant_permission(user, 'Addons:Review')
|
||||
self.client.login_api(user)
|
||||
|
@ -1628,7 +1607,7 @@ class AddonAndVersionViewSetDetailMixin(object):
|
|||
assert response.status_code == 200
|
||||
|
||||
def test_get_not_public_author(self):
|
||||
self.addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
user = UserProfile.objects.create(username='author')
|
||||
AddonUser.objects.create(user=user, addon=self.addon)
|
||||
self.client.login_api(user)
|
||||
|
@ -2150,46 +2129,24 @@ class TestAddonSearchView(ESTestCase):
|
|||
weekly_downloads=222)
|
||||
addon_factory(slug='my-incomplete-addon', name=u'My incomplete Addôn',
|
||||
status=amo.STATUS_NULL)
|
||||
addon_factory(slug='my-unreviewed-addon', name=u'My unreviewed Addôn',
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
lite_addon = addon_factory(slug='my-lite-addon',
|
||||
name=u'My Preliminarily Reviewed Addôn',
|
||||
status=amo.STATUS_LITE,
|
||||
weekly_downloads=22)
|
||||
addon_factory(slug='my-disabled-addon', name=u'My disabled Addôn',
|
||||
status=amo.STATUS_DISABLED)
|
||||
addon_factory(slug='my-unlisted-addon', name=u'My unlisted Addôn',
|
||||
is_listed=False)
|
||||
lite_and_nominated_addon = addon_factory(
|
||||
slug='my-lite-and-nominated-addon',
|
||||
name=u'My Preliminary Reviewed and Awaiting Full Review Addôn',
|
||||
status=amo.STATUS_LITE_AND_NOMINATED,
|
||||
weekly_downloads=2)
|
||||
addon_factory(slug='my-disabled-by-user-addon',
|
||||
name=u'My disabled by user Addôn',
|
||||
disabled_by_user=True)
|
||||
self.refresh()
|
||||
|
||||
data = self.perform_search(self.url)
|
||||
assert data['count'] == 3
|
||||
assert len(data['results']) == 3
|
||||
assert data['count'] == 1
|
||||
assert len(data['results']) == 1
|
||||
|
||||
result = data['results'][0]
|
||||
assert result['id'] == public_addon.pk
|
||||
assert result['name'] == {'en-US': u'My Addôn'}
|
||||
assert result['slug'] == 'my-addon'
|
||||
|
||||
result = data['results'][1]
|
||||
assert result['id'] == lite_addon.pk
|
||||
assert result['name'] == {'en-US': u'My Preliminarily Reviewed Addôn'}
|
||||
assert result['slug'] == 'my-lite-addon'
|
||||
|
||||
result = data['results'][2]
|
||||
assert result['id'] == lite_and_nominated_addon.pk
|
||||
assert result['name'] == {
|
||||
'en-US': u'My Preliminary Reviewed and Awaiting Full Review Addôn'}
|
||||
assert result['slug'] == 'my-lite-and-nominated-addon'
|
||||
|
||||
def test_with_query(self):
|
||||
addon = addon_factory(slug='my-addon', name=u'My Addôn',
|
||||
tags=['some_tag'])
|
||||
|
|
|
@ -428,7 +428,7 @@ def developers(request, addon, page):
|
|||
if addon.is_persona():
|
||||
raise http.Http404()
|
||||
if 'version' in request.GET:
|
||||
qs = addon.versions.filter(files__status__in=amo.VALID_STATUSES)
|
||||
qs = addon.versions.filter(files__status__in=amo.VALID_ADDON_STATUSES)
|
||||
version = get_list_or_404(qs, version=request.GET['version'])[0]
|
||||
else:
|
||||
version = addon.current_version
|
||||
|
@ -547,7 +547,7 @@ def paypal_result(request, addon, status):
|
|||
@non_atomic_requests
|
||||
def license(request, addon, version=None):
|
||||
if version is not None:
|
||||
qs = addon.versions.filter(files__status__in=amo.VALID_STATUSES)
|
||||
qs = addon.versions.filter(files__status__in=amo.VALID_FILE_STATUSES)
|
||||
version = get_list_or_404(qs, version=version)[0]
|
||||
else:
|
||||
version = addon.current_version
|
||||
|
@ -695,7 +695,7 @@ class AddonVersionViewSet(AddonChildMixin, RetrieveModelMixin,
|
|||
# queryset filtering to hide non-valid versions. get_queryset() might
|
||||
# override this if we are asked to see non-valid versions explicitly.
|
||||
queryset = Version.objects.filter(
|
||||
files__status__in=amo.VALID_STATUSES).distinct()
|
||||
files__status__in=amo.VALID_FILE_STATUSES).distinct()
|
||||
|
||||
def get_queryset(self):
|
||||
"""Return the right base queryset depending on the situation. Note that
|
||||
|
|
|
@ -13,7 +13,7 @@ from olympia import amo
|
|||
from olympia.amo.utils import chunked
|
||||
from olympia.amo.helpers import user_media_path
|
||||
from olympia.bandwagon.models import Collection
|
||||
from olympia.constants.base import VALID_STATUSES
|
||||
from olympia.constants.base import VALID_ADDON_STATUSES, VALID_FILE_STATUSES
|
||||
from olympia.devhub.models import ActivityLog
|
||||
from olympia.lib.es.utils import raise_if_reindex_in_progress
|
||||
from olympia.stats.models import Contribution
|
||||
|
@ -101,7 +101,8 @@ def category_totals():
|
|||
Update category counts for sidebar navigation.
|
||||
"""
|
||||
log.debug('Starting category counts update...')
|
||||
p = ",".join(['%s'] * len(VALID_STATUSES))
|
||||
addon_statuses = ",".join(['%s'] * len(VALID_ADDON_STATUSES))
|
||||
file_statuses = ",".join(['%s'] * len(VALID_FILE_STATUSES))
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("""
|
||||
UPDATE categories AS t INNER JOIN (
|
||||
|
@ -116,7 +117,8 @@ def category_totals():
|
|||
GROUP BY at.category_id)
|
||||
AS j ON (t.id = j.category_id)
|
||||
SET t.count = j.ct
|
||||
""" % (p, p), VALID_STATUSES * 2)
|
||||
""" % (file_statuses, addon_statuses),
|
||||
VALID_FILE_STATUSES + VALID_ADDON_STATUSES)
|
||||
|
||||
|
||||
@cronjobs.register
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"bayesian_rating": 4.0337899999999998,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"total_contributions": "0.00",
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -365,7 +365,7 @@
|
|||
"bayesian_rating": 0.0,
|
||||
"support_email": null,
|
||||
"public_stats": 0,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
"target_locale": null,
|
||||
|
|
|
@ -18,7 +18,7 @@ class TestESIndexing(ESTestCaseWithAddons):
|
|||
# Created in the setUpClass.
|
||||
assert count == 4 == (
|
||||
Addon.objects.filter(disabled_by_user=False,
|
||||
status__in=amo.VALID_STATUSES).count())
|
||||
status__in=amo.VALID_ADDON_STATUSES).count())
|
||||
|
||||
def test_get_es_not_mocked(self):
|
||||
es = search.get_es()
|
||||
|
|
|
@ -157,7 +157,7 @@ class TestViews(TestCase):
|
|||
def test_unreviewed_addon(self):
|
||||
u = UserProfile.objects.get(email='jbalogh@mozilla.com')
|
||||
addon = Addon.objects.all()[0]
|
||||
addon.status = amo.STATUS_UNREVIEWED
|
||||
addon.status = amo.STATUS_NOMINATED
|
||||
c = u.favorites_collection()
|
||||
amo.set_user(u)
|
||||
c.add_addon(addon)
|
||||
|
|
|
@ -223,7 +223,7 @@ def collection_detail(request, username, slug):
|
|||
notes = get_notes(c)
|
||||
# Go directly to CollectionAddon for the count to avoid joins.
|
||||
count = CollectionAddon.objects.filter(
|
||||
Addon.objects.valid_q(amo.VALID_STATUSES, prefix='addon__'),
|
||||
Addon.objects.valid_q(amo.VALID_ADDON_STATUSES, prefix='addon__'),
|
||||
collection=c.id)
|
||||
addons = paginate(request, filter.qs, per_page=15, count=count.count())
|
||||
|
||||
|
|
|
@ -665,47 +665,15 @@ class TestListingByStatus(TestCase):
|
|||
addons = list(r.context['addons'].object_list)
|
||||
assert addons == exp
|
||||
|
||||
def test_public_public_listed(self):
|
||||
def test_public_public_visible(self):
|
||||
self.get_addon(amo.STATUS_PUBLIC, amo.STATUS_PUBLIC)
|
||||
self.check([self.addon])
|
||||
|
||||
def test_public_nom_unlisted(self):
|
||||
self.get_addon(amo.STATUS_PUBLIC, amo.STATUS_NOMINATED)
|
||||
def test_public_unreviewed_notvisible(self):
|
||||
self.get_addon(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW)
|
||||
self.check([])
|
||||
|
||||
def test_public_lite_unlisted(self):
|
||||
self.get_addon(amo.STATUS_PUBLIC, amo.STATUS_LITE)
|
||||
self.check([])
|
||||
|
||||
def test_lite_unreviewed_unlisted(self):
|
||||
self.get_addon(amo.STATUS_LITE, amo.STATUS_UNREVIEWED)
|
||||
self.check([])
|
||||
|
||||
def test_lite_lite_listed(self):
|
||||
self.get_addon(amo.STATUS_LITE, amo.STATUS_LITE)
|
||||
self.check([self.addon])
|
||||
|
||||
def test_lite_lan_listed(self):
|
||||
self.get_addon(amo.STATUS_LITE, amo.STATUS_LITE_AND_NOMINATED)
|
||||
self.check([self.addon])
|
||||
|
||||
def test_lan_unreviewed_unlisted(self):
|
||||
self.get_addon(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_UNREVIEWED)
|
||||
self.check([])
|
||||
|
||||
def test_lan_lite_listed(self):
|
||||
self.get_addon(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE)
|
||||
self.check([self.addon])
|
||||
|
||||
def test_lan_public_listed(self):
|
||||
self.get_addon(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_PUBLIC)
|
||||
self.check([self.addon])
|
||||
|
||||
def test_unreviewed_public_unlisted(self):
|
||||
self.get_addon(amo.STATUS_UNREVIEWED, amo.STATUS_PUBLIC)
|
||||
self.check([])
|
||||
|
||||
def test_nom_public_unlisted(self):
|
||||
def test_nom_public_notvisible(self):
|
||||
self.get_addon(amo.STATUS_NOMINATED, amo.STATUS_PUBLIC)
|
||||
self.check([])
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def compatibility_report(index=None):
|
|||
latest = UpdateCount.objects.aggregate(d=Max('date'))['d']
|
||||
qs = UpdateCount.objects.filter(addon__appsupport__app=amo.FIREFOX.id,
|
||||
addon__disabled_by_user=False,
|
||||
addon__status__in=amo.VALID_STATUSES,
|
||||
addon__status__in=amo.VALID_ADDON_STATUSES,
|
||||
addon___current_version__isnull=False,
|
||||
date=latest)
|
||||
|
||||
|
|
|
@ -192,7 +192,6 @@ PERSONA_DEFAULT_PAGES = 2
|
|||
|
||||
# Signing
|
||||
SIGNING_SERVER = env('SIGNING_SERVER')
|
||||
PRELIMINARY_SIGNING_SERVER = env('PRELIMINARY_SIGNING_SERVER')
|
||||
|
||||
# sandbox
|
||||
PAYPAL_PAY_URL = 'https://svcs.sandbox.paypal.com/AdaptivePayments/'
|
||||
|
|
|
@ -174,7 +174,6 @@ AES_KEYS = env.dict('AES_KEYS')
|
|||
|
||||
# Signing
|
||||
SIGNING_SERVER = env('SIGNING_SERVER')
|
||||
PRELIMINARY_SIGNING_SERVER = env('PRELIMINARY_SIGNING_SERVER')
|
||||
|
||||
PAYPAL_APP_ID = env('PAYPAL_APP_ID')
|
||||
|
||||
|
|
|
@ -186,7 +186,6 @@ PERSONA_DEFAULT_PAGES = 5
|
|||
|
||||
# Signing
|
||||
SIGNING_SERVER = env('SIGNING_SERVER')
|
||||
PRELIMINARY_SIGNING_SERVER = env('PRELIMINARY_SIGNING_SERVER')
|
||||
|
||||
# sandbox
|
||||
PAYPAL_PAY_URL = 'https://svcs.sandbox.paypal.com/AdaptivePayments/'
|
||||
|
|
|
@ -6,28 +6,24 @@ from django.utils.translation import ugettext_lazy as _
|
|||
|
||||
# Add-on and File statuses.
|
||||
STATUS_NULL = 0 # No review type chosen yet, add-on is incomplete.
|
||||
STATUS_UNREVIEWED = 1 # Waiting for prelim review.
|
||||
STATUS_AWAITING_REVIEW = 1 # File waiting for review.
|
||||
STATUS_PENDING = 2 # Personas (lightweight themes) waiting for review.
|
||||
STATUS_NOMINATED = 3 # Waiting for full review.
|
||||
STATUS_PUBLIC = 4 # Fully reviewed.
|
||||
STATUS_DISABLED = 5 # Rejected (single files) or disabled by Mozilla (addons).
|
||||
_STATUS_LISTED = 6 # Deprecated. See bug 616242
|
||||
STATUS_BETA = 7 # Beta file, only available on fully reviewed add-ons.
|
||||
STATUS_LITE = 8 # Preliminary reviewed.
|
||||
STATUS_LITE_AND_NOMINATED = 9 # Preliminary reviewed, waiting for full review.
|
||||
_STATUS_LITE = 8 # Deprecated, preliminary reviewed.
|
||||
_STATUS_LITE_AND_NOMINATED = 9 # Deprecated, prelim & waiting for full review.
|
||||
STATUS_DELETED = 11 # Add-on has been deleted.
|
||||
STATUS_REJECTED = 12 # This applies only to rejected personas.
|
||||
STATUS_REVIEW_PENDING = 14 # Themes queue, reviewed, needs further action.
|
||||
|
||||
STATUS_CHOICES_ADDON = {
|
||||
STATUS_NULL: _(u'Incomplete'),
|
||||
STATUS_UNREVIEWED: _(u'Awaiting Preliminary Review'),
|
||||
STATUS_NOMINATED: _(u'Awaiting Full Review'),
|
||||
STATUS_PUBLIC: _(u'Fully Reviewed'),
|
||||
STATUS_DISABLED: _(u'Disabled by Mozilla'),
|
||||
STATUS_LITE: _(u'Preliminarily Reviewed'),
|
||||
STATUS_LITE_AND_NOMINATED: _(
|
||||
u'Preliminarily Reviewed and Awaiting Full Review'),
|
||||
STATUS_DELETED: _(u'Deleted'),
|
||||
}
|
||||
|
||||
|
@ -43,24 +39,21 @@ STATUS_CHOICES_PERSONA = {
|
|||
}
|
||||
|
||||
STATUS_CHOICES_FILE = {
|
||||
STATUS_UNREVIEWED: _(u'Awaiting Review'),
|
||||
STATUS_AWAITING_REVIEW: _(u'Awaiting Review'),
|
||||
STATUS_PUBLIC: _(u'Fully Reviewed'),
|
||||
STATUS_DISABLED: _(u'Disabled by Mozilla'),
|
||||
STATUS_BETA: _(u'Beta'),
|
||||
STATUS_LITE: _(u'Preliminarily Reviewed'),
|
||||
}
|
||||
|
||||
# We need to expose nice values that aren't localisable.
|
||||
STATUS_CHOICES_API = {
|
||||
STATUS_NULL: 'incomplete',
|
||||
STATUS_UNREVIEWED: 'unreviewed',
|
||||
STATUS_AWAITING_REVIEW: 'unreviewed',
|
||||
STATUS_PENDING: 'pending',
|
||||
STATUS_NOMINATED: 'nominated',
|
||||
STATUS_PUBLIC: 'public',
|
||||
STATUS_DISABLED: 'disabled',
|
||||
STATUS_BETA: 'beta',
|
||||
STATUS_LITE: 'lite',
|
||||
STATUS_LITE_AND_NOMINATED: 'lite-nominated',
|
||||
STATUS_DELETED: 'deleted',
|
||||
STATUS_REJECTED: 'rejected',
|
||||
STATUS_REVIEW_PENDING: 'review-pending',
|
||||
|
@ -68,14 +61,12 @@ STATUS_CHOICES_API = {
|
|||
|
||||
STATUS_CHOICES_API_LOOKUP = {
|
||||
'incomplete': STATUS_NULL,
|
||||
'unreviewed': STATUS_UNREVIEWED,
|
||||
'unreviewed': STATUS_AWAITING_REVIEW,
|
||||
'pending': STATUS_PENDING,
|
||||
'nominated': STATUS_NOMINATED,
|
||||
'public': STATUS_PUBLIC,
|
||||
'disabled': STATUS_DISABLED,
|
||||
'beta': STATUS_BETA,
|
||||
'lite': STATUS_LITE,
|
||||
'lite-nominated': STATUS_LITE_AND_NOMINATED,
|
||||
'deleted': STATUS_DELETED,
|
||||
'rejected': STATUS_REJECTED,
|
||||
'review-pending': STATUS_REVIEW_PENDING,
|
||||
|
@ -85,28 +76,19 @@ PUBLIC_IMMEDIATELY = None
|
|||
# Our MySQL does not store microseconds.
|
||||
PUBLIC_WAIT = datetime.max.replace(microsecond=0)
|
||||
|
||||
REVIEWED_STATUSES = (STATUS_LITE, STATUS_LITE_AND_NOMINATED, STATUS_PUBLIC)
|
||||
UNREVIEWED_STATUSES = (STATUS_UNREVIEWED, STATUS_PENDING, STATUS_NOMINATED)
|
||||
VALID_STATUSES = (STATUS_UNREVIEWED, STATUS_PENDING, STATUS_NOMINATED,
|
||||
STATUS_PUBLIC, STATUS_BETA, STATUS_LITE,
|
||||
STATUS_LITE_AND_NOMINATED)
|
||||
# We don't show addons/versions with UNREVIEWED_STATUS in public.
|
||||
LISTED_STATUSES = tuple(st for st in VALID_STATUSES if st != STATUS_PENDING)
|
||||
REVIEWED_STATUSES = (STATUS_PUBLIC,)
|
||||
UNREVIEWED_ADDON_STATUSES = (STATUS_NOMINATED,)
|
||||
UNREVIEWED_FILE_STATUSES = (STATUS_AWAITING_REVIEW, STATUS_PENDING)
|
||||
VALID_ADDON_STATUSES = (STATUS_NOMINATED, STATUS_PUBLIC)
|
||||
VALID_FILE_STATUSES = (STATUS_AWAITING_REVIEW, STATUS_PUBLIC, STATUS_BETA)
|
||||
|
||||
# An add-on in one of these statuses is awaiting a review.
|
||||
UNDER_REVIEW_STATUSES = (STATUS_UNREVIEWED, STATUS_NOMINATED,
|
||||
STATUS_LITE_AND_NOMINATED)
|
||||
UNDER_REVIEW_STATUSES = (STATUS_NOMINATED,)
|
||||
|
||||
LITE_STATUSES = (STATUS_LITE, STATUS_LITE_AND_NOMINATED)
|
||||
|
||||
MIRROR_STATUSES = (STATUS_PUBLIC, STATUS_BETA,
|
||||
STATUS_LITE, STATUS_LITE_AND_NOMINATED)
|
||||
MIRROR_STATUSES = (STATUS_PUBLIC, STATUS_BETA)
|
||||
|
||||
# Fully reviewed of waiting for a full review.
|
||||
FULL_REVIEW_STATUSES = [STATUS_NOMINATED, STATUS_LITE_AND_NOMINATED,
|
||||
STATUS_PUBLIC]
|
||||
# Prelim reviewed of waiting for a prelim review.
|
||||
PRELIM_REVIEW_STATUSES = [STATUS_UNREVIEWED, STATUS_LITE]
|
||||
FULL_REVIEW_STATUSES = [STATUS_NOMINATED, STATUS_PUBLIC]
|
||||
|
||||
# Add-on author roles.
|
||||
AUTHOR_ROLE_VIEWER = 1
|
||||
|
@ -432,46 +414,47 @@ ADDON_UUID = r'(?P<uuid>[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})'
|
|||
# Note: Don't change these since they're used as keys in the database.
|
||||
REVIEWED_MANUAL = 0
|
||||
REVIEWED_ADDON_FULL = 10
|
||||
REVIEWED_ADDON_PRELIM = 11
|
||||
_REVIEWED_ADDON_PRELIM = 11 # Deprecated for new reviews - no more prelim.
|
||||
REVIEWED_ADDON_UPDATE = 12
|
||||
REVIEWED_DICT_FULL = 20
|
||||
REVIEWED_DICT_PRELIM = 21
|
||||
_REVIEWED_DICT_PRELIM = 21 # Deprecated for new reviews - no more prelim.
|
||||
REVIEWED_DICT_UPDATE = 22
|
||||
REVIEWED_LP_FULL = 30
|
||||
REVIEWED_LP_PRELIM = 31
|
||||
_REVIEWED_LP_PRELIM = 31 # Deprecated for new reviews - no more prelim.
|
||||
REVIEWED_LP_UPDATE = 32
|
||||
REVIEWED_OVERDUE_BONUS = 2
|
||||
REVIEWED_OVERDUE_LIMIT = 7
|
||||
REVIEWED_PERSONA = 40
|
||||
# TODO: Leaving room for persona points based on queue.
|
||||
REVIEWED_SEARCH_FULL = 50
|
||||
REVIEWED_SEARCH_PRELIM = 51
|
||||
_REVIEWED_SEARCH_PRELIM = 51 # Deprecated for new reviews - no more prelim.
|
||||
REVIEWED_SEARCH_UPDATE = 52
|
||||
REVIEWED_THEME_FULL = 60
|
||||
REVIEWED_THEME_PRELIM = 61
|
||||
_REVIEWED_THEME_PRELIM = 61 # Deprecated for new reviews - no more prelim.
|
||||
REVIEWED_THEME_UPDATE = 62
|
||||
REVIEWED_ADDON_REVIEW = 80
|
||||
REVIEWED_ADDON_REVIEW_POORLY = 81
|
||||
|
||||
# We need to keep the deprecated choices for existing points in the database.
|
||||
REVIEWED_CHOICES = {
|
||||
REVIEWED_MANUAL: _('Manual Reviewer Points'),
|
||||
REVIEWED_ADDON_FULL: _('Full Add-on Review'),
|
||||
REVIEWED_ADDON_PRELIM: _('Preliminary Add-on Review'),
|
||||
_REVIEWED_ADDON_PRELIM: _('Preliminary Add-on Review'),
|
||||
REVIEWED_ADDON_UPDATE: _('Updated Add-on Review'),
|
||||
REVIEWED_DICT_FULL: _('Full Dictionary Review'),
|
||||
REVIEWED_DICT_PRELIM: _('Preliminary Dictionary Review'),
|
||||
_REVIEWED_DICT_PRELIM: _('Preliminary Dictionary Review'),
|
||||
REVIEWED_DICT_UPDATE: _('Updated Dictionary Review'),
|
||||
REVIEWED_LP_FULL: _('Full Language Pack Review'),
|
||||
REVIEWED_LP_PRELIM: _('Preliminary Language Pack Review'),
|
||||
_REVIEWED_LP_PRELIM: _('Preliminary Language Pack Review'),
|
||||
REVIEWED_LP_UPDATE: _('Updated Language Pack Review'),
|
||||
REVIEWED_OVERDUE_BONUS: _('Bonus for overdue reviews'),
|
||||
REVIEWED_OVERDUE_LIMIT: _('Days Before Bonus Points Applied'),
|
||||
REVIEWED_PERSONA: _('Theme Review'),
|
||||
REVIEWED_SEARCH_FULL: _('Full Search Provider Review'),
|
||||
REVIEWED_SEARCH_PRELIM: _('Preliminary Search Provider Review'),
|
||||
_REVIEWED_SEARCH_PRELIM: _('Preliminary Search Provider Review'),
|
||||
REVIEWED_SEARCH_UPDATE: _('Updated Search Provider Review'),
|
||||
REVIEWED_THEME_FULL: _('Complete Theme Review'),
|
||||
REVIEWED_THEME_PRELIM: _('Preliminary Complete Theme Review'),
|
||||
_REVIEWED_THEME_PRELIM: _('Preliminary Complete Theme Review'),
|
||||
REVIEWED_THEME_UPDATE: _('Updated Complete Theme Review'),
|
||||
REVIEWED_ADDON_REVIEW: _('Moderated Addon Review'),
|
||||
REVIEWED_ADDON_REVIEW_POORLY: _('Addon Review Moderation Reverted'),
|
||||
|
@ -480,22 +463,17 @@ REVIEWED_CHOICES = {
|
|||
REVIEWED_SCORES = {
|
||||
REVIEWED_MANUAL: 0,
|
||||
REVIEWED_ADDON_FULL: 120,
|
||||
REVIEWED_ADDON_PRELIM: 60,
|
||||
REVIEWED_ADDON_UPDATE: 80,
|
||||
REVIEWED_DICT_FULL: 60,
|
||||
REVIEWED_DICT_PRELIM: 20,
|
||||
REVIEWED_DICT_UPDATE: 60,
|
||||
REVIEWED_LP_FULL: 60,
|
||||
REVIEWED_LP_PRELIM: 20,
|
||||
REVIEWED_LP_UPDATE: 60,
|
||||
REVIEWED_OVERDUE_BONUS: 2,
|
||||
REVIEWED_OVERDUE_LIMIT: 7,
|
||||
REVIEWED_PERSONA: 5,
|
||||
REVIEWED_SEARCH_FULL: 30,
|
||||
REVIEWED_SEARCH_PRELIM: 10,
|
||||
REVIEWED_SEARCH_UPDATE: 30,
|
||||
REVIEWED_THEME_FULL: 80,
|
||||
REVIEWED_THEME_PRELIM: 40,
|
||||
REVIEWED_THEME_UPDATE: 80,
|
||||
REVIEWED_ADDON_REVIEW: 1,
|
||||
REVIEWED_ADDON_REVIEW_POORLY: -1, # -REVIEWED_ADDON_REVIEW
|
||||
|
@ -503,19 +481,14 @@ REVIEWED_SCORES = {
|
|||
|
||||
REVIEWED_AMO = (
|
||||
REVIEWED_ADDON_FULL,
|
||||
REVIEWED_ADDON_PRELIM,
|
||||
REVIEWED_ADDON_UPDATE,
|
||||
REVIEWED_DICT_FULL,
|
||||
REVIEWED_DICT_PRELIM,
|
||||
REVIEWED_DICT_UPDATE,
|
||||
REVIEWED_LP_FULL,
|
||||
REVIEWED_LP_PRELIM,
|
||||
REVIEWED_LP_UPDATE,
|
||||
REVIEWED_SEARCH_FULL,
|
||||
REVIEWED_SEARCH_PRELIM,
|
||||
REVIEWED_SEARCH_UPDATE,
|
||||
REVIEWED_THEME_FULL,
|
||||
REVIEWED_THEME_PRELIM,
|
||||
REVIEWED_THEME_UPDATE,
|
||||
REVIEWED_ADDON_REVIEW,
|
||||
)
|
||||
|
@ -536,17 +509,6 @@ REVIEWED_LEVELS = [
|
|||
# Addons:DelayedReviews
|
||||
REVIEW_LIMITED_DELAY_HOURS = 20
|
||||
|
||||
# Signed state.
|
||||
UNSIGNED = 0
|
||||
SIGNED_FULL = 1
|
||||
SIGNED_PRELIM = 2
|
||||
|
||||
SIGNED_CHOICES = {
|
||||
UNSIGNED: _(u'Not signed'),
|
||||
SIGNED_FULL: _(u'Signed for a full review'),
|
||||
SIGNED_PRELIM: _(u'Signed of a preliminary review'),
|
||||
}
|
||||
|
||||
# Default strict_min_version and strict_max_version for WebExtensions
|
||||
DEFAULT_WEBEXT_MIN_VERSION = '42.0'
|
||||
DEFAULT_WEBEXT_MAX_VERSION = '*'
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
"homepage": null,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
"homepage": null,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 1,
|
||||
"status": 3,
|
||||
"privacy_policy": null,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
<a href="#" class="remove" data-version="{{ version.id }}" data-is-current="{{ (version == addon.current_version)|int }}">x</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% set request_reviews=addon.can_request_review(disallow_preliminary_review=True) %}
|
||||
{% set request_reviews=addon.can_request_review() %}
|
||||
{% set can_cancel=(not addon.is_disabled and addon.status==amo.STATUS_NOMINATED) %}
|
||||
{% if full_info and check_addon_ownership(request, addon, dev=True) and (request_reviews or can_cancel) %}
|
||||
<tr>
|
||||
|
|
|
@ -167,7 +167,7 @@ class TestDevFilesStatus(TestCase):
|
|||
self.version = Version.objects.create(addon=self.addon)
|
||||
self.file = File.objects.create(version=self.version,
|
||||
platform=amo.PLATFORM_ALL.id,
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
def expect(self, expected):
|
||||
cnt, msg = helpers.dev_files_status([self.file])[0]
|
||||
|
@ -176,13 +176,13 @@ class TestDevFilesStatus(TestCase):
|
|||
|
||||
def test_unreviewed_public(self):
|
||||
self.addon.status = amo.STATUS_PUBLIC
|
||||
self.file.status = amo.STATUS_UNREVIEWED
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_UNREVIEWED])
|
||||
self.file.status = amo.STATUS_AWAITING_REVIEW
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_AWAITING_REVIEW])
|
||||
|
||||
def test_unreviewed_nominated(self):
|
||||
self.addon.status = amo.STATUS_NOMINATED
|
||||
self.file.status = amo.STATUS_UNREVIEWED
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_UNREVIEWED])
|
||||
self.file.status = amo.STATUS_AWAITING_REVIEW
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_AWAITING_REVIEW])
|
||||
|
||||
def test_reviewed_public(self):
|
||||
self.addon.status = amo.STATUS_PUBLIC
|
||||
|
@ -191,8 +191,8 @@ class TestDevFilesStatus(TestCase):
|
|||
|
||||
def test_reviewed_null(self):
|
||||
self.addon.status = amo.STATUS_NULL
|
||||
self.file.status = amo.STATUS_UNREVIEWED
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_UNREVIEWED])
|
||||
self.file.status = amo.STATUS_AWAITING_REVIEW
|
||||
self.expect(File.STATUS_CHOICES[amo.STATUS_AWAITING_REVIEW])
|
||||
|
||||
def test_disabled(self):
|
||||
self.addon.status = amo.STATUS_PUBLIC
|
||||
|
|
|
@ -222,8 +222,7 @@ class TestValidator(ValidatorTestCase):
|
|||
'unexpected_exception']
|
||||
assert not self.upload.valid
|
||||
|
||||
@override_settings(SIGNING_SERVER='http://full',
|
||||
PRELIMINARY_SIGNING_SERVER='http://prelim')
|
||||
@override_settings(SIGNING_SERVER='http://full')
|
||||
@mock.patch('olympia.devhub.tasks.run_validator')
|
||||
def test_validation_signing_warning(self, _mock):
|
||||
"""If we sign addons, warn on signed addon submission."""
|
||||
|
@ -233,7 +232,7 @@ class TestValidator(ValidatorTestCase):
|
|||
assert validation['warnings'] == 1
|
||||
assert len(validation['messages']) == 1
|
||||
|
||||
@override_settings(SIGNING_SERVER='', PRELIMINARY_SIGNING_SERVER='')
|
||||
@override_settings(SIGNING_SERVER='')
|
||||
@mock.patch('olympia.devhub.tasks.run_validator')
|
||||
def test_validation_no_signing_warning(self, _mock):
|
||||
"""If we're not signing addon don't warn on signed addon submission."""
|
||||
|
|
|
@ -666,7 +666,7 @@ class TestValidationAnnotatorListed(TestValidationAnnotatorBase):
|
|||
"""Test that a full reviewed version is not matched to an unreviewed
|
||||
version."""
|
||||
|
||||
self.file_1_1.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.file_1_1.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.check_upload(self.file)
|
||||
|
||||
# We can't prevent matching against beta versions
|
||||
|
@ -681,7 +681,7 @@ class TestValidationAnnotatorListed(TestValidationAnnotatorBase):
|
|||
|
||||
self.check_file(self.file_1_1, self.file)
|
||||
|
||||
for status in amo.STATUS_UNREVIEWED, amo.STATUS_BETA:
|
||||
for status in amo.STATUS_AWAITING_REVIEW, amo.STATUS_BETA:
|
||||
self.validate_file.reset_mock()
|
||||
self.save_file.reset_mock()
|
||||
|
||||
|
|
|
@ -847,14 +847,14 @@ class TestHome(TestCase):
|
|||
assert self.get_pq()('#devhub-sidebar #editor-promo').length == 0
|
||||
|
||||
def test_my_addons(self):
|
||||
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED)]
|
||||
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW)]
|
||||
|
||||
for addon_status in statuses:
|
||||
for addon_status, file_status in statuses:
|
||||
file = self.addon.latest_version.files.all()[0]
|
||||
file.update(status=addon_status[1])
|
||||
file.update(status=file_status)
|
||||
|
||||
self.addon.update(status=addon_status[0])
|
||||
self.addon.update(status=addon_status)
|
||||
|
||||
doc = self.get_pq()
|
||||
addon_item = doc('#my-addons .addon-item')
|
||||
|
@ -2395,8 +2395,8 @@ class TestQueuePosition(UploadTest):
|
|||
assert pq(r.content)('.version-status-actions .dark').length == 0
|
||||
|
||||
def test_in_queue(self):
|
||||
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED)]
|
||||
statuses = [(amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW)]
|
||||
|
||||
for addon_status in statuses:
|
||||
self.addon.status = addon_status[0]
|
||||
|
@ -2428,7 +2428,7 @@ class TestVersionAddFile(UploadTest):
|
|||
args=[self.addon.slug, self.version.id])
|
||||
version_files = self.version.files.all()[0]
|
||||
version_files.update(platform=amo.PLATFORM_LINUX.id,
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
# We need to clear the cached properties for platform change above.
|
||||
del self.version.supported_platforms
|
||||
|
@ -2482,8 +2482,9 @@ class TestVersionAddFile(UploadTest):
|
|||
file.pk = None
|
||||
file.save()
|
||||
|
||||
cases = [(amo.STATUS_UNREVIEWED, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED, False)]
|
||||
cases = (
|
||||
(amo.STATUS_AWAITING_REVIEW, amo.STATUS_AWAITING_REVIEW, True),
|
||||
(amo.STATUS_DISABLED, amo.STATUS_AWAITING_REVIEW, False))
|
||||
|
||||
for c in cases:
|
||||
version_files = self.addon.latest_version.files.all()
|
||||
|
@ -3030,11 +3031,10 @@ class TestAddBetaVersion(AddVersionTest):
|
|||
def test_force_not_beta(self):
|
||||
self.post(beta=False)
|
||||
f = File.objects.latest()
|
||||
assert f.status == amo.STATUS_UNREVIEWED
|
||||
assert f.status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
@mock.patch('olympia.devhub.views.sign_file')
|
||||
def test_listed_beta_pass_validation(self, mock_sign_file):
|
||||
"""Beta files that pass validation are signed with prelim cert."""
|
||||
self.addon.update(
|
||||
is_listed=True, status=amo.STATUS_PUBLIC)
|
||||
# Make sure the file has no validation warnings nor errors.
|
||||
|
|
|
@ -1209,7 +1209,7 @@ class TestEditTechnical(TestEdit):
|
|||
def test_dependencies_no_add_unreviewed(self):
|
||||
"""Ensure that unreviewed add-ons cannot be made as dependencies."""
|
||||
addon = Addon.objects.get(id=40)
|
||||
for status in amo.UNREVIEWED_STATUSES:
|
||||
for status in amo.UNREVIEWED_ADDON_STATUSES:
|
||||
addon.update(status=status)
|
||||
|
||||
assert addon not in list(Addon.objects.reviewed())
|
||||
|
|
|
@ -427,7 +427,7 @@ class TestUploadURLs(TestCase):
|
|||
def test_upload_addon_version(self):
|
||||
"""Test that the add-on update upload URLs result in file uploads
|
||||
with the correct flags."""
|
||||
for status in amo.VALID_STATUSES:
|
||||
for status in amo.VALID_ADDON_STATUSES:
|
||||
self.upload_addon(listed=True, status=status)
|
||||
self.expect_validation(listed=True, automated_signing=False)
|
||||
|
||||
|
|
|
@ -216,7 +216,8 @@ class TestVersion(TestCase):
|
|||
def test_user_can_disable_addon_pending_version(self, hide_mock):
|
||||
self.addon.update(status=amo.STATUS_PUBLIC,
|
||||
disabled_by_user=False)
|
||||
(new_version, _) = self._extra_version_and_file(amo.STATUS_UNREVIEWED)
|
||||
(new_version, _) = self._extra_version_and_file(
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
assert self.addon.latest_version == new_version
|
||||
|
||||
res = self.client.post(self.disable_url)
|
||||
|
@ -274,7 +275,7 @@ class TestVersion(TestCase):
|
|||
signing_summary=dict(trivial=0, low=0, medium=0,
|
||||
high=0))
|
||||
FileValidation.from_json(file, validation)
|
||||
file.update(status=amo.STATUS_UNREVIEWED)
|
||||
file.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
self.client.post(self.unlist_url)
|
||||
|
||||
|
@ -471,7 +472,7 @@ class TestVersion(TestCase):
|
|||
def test_version_history(self):
|
||||
self.client.cookies['jwt_api_auth_token'] = 'magicbeans'
|
||||
v1 = self.version
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_UNREVIEWED)
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
r = self.client.get(self.url)
|
||||
assert r.status_code == 200
|
||||
|
@ -501,7 +502,7 @@ class TestVersion(TestCase):
|
|||
def test_version_history_activity_email_waffle_off(self):
|
||||
self.client.cookies['jwt_api_auth_token'] = 'magicbeans'
|
||||
v1 = self.version
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_UNREVIEWED)
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
r = self.client.get(self.url)
|
||||
assert r.status_code == 200
|
||||
|
@ -525,7 +526,7 @@ class TestVersion(TestCase):
|
|||
assert doc('.dev-review-reply').length == 0
|
||||
|
||||
def test_pending_activity_count(self):
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_UNREVIEWED)
|
||||
v2, _ = self._extra_version_and_file(amo.STATUS_AWAITING_REVIEW)
|
||||
# Add some activity log messages
|
||||
amo.log(amo.LOG.REQUEST_INFORMATION, v2.addon, v2, user=self.user)
|
||||
amo.log(amo.LOG.REQUEST_INFORMATION, v2.addon, v2, user=self.user)
|
||||
|
@ -795,7 +796,7 @@ class TestVersionEditFiles(TestVersionEditBase):
|
|||
|
||||
def test_delete_file(self):
|
||||
version = self.addon.current_version
|
||||
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
|
||||
version.files.all()[0].update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
assert self.version.files.count() == 1
|
||||
forms = map(initial,
|
||||
|
@ -837,7 +838,7 @@ class TestVersionEditFiles(TestVersionEditBase):
|
|||
|
||||
def test_all_platforms(self):
|
||||
version = self.addon.current_version
|
||||
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
|
||||
version.files.all()[0].update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
File.objects.create(version=self.version,
|
||||
platform=amo.PLATFORM_MAC.id)
|
||||
|
@ -849,7 +850,7 @@ class TestVersionEditFiles(TestVersionEditBase):
|
|||
|
||||
def test_all_platforms_and_delete(self):
|
||||
version = self.addon.current_version
|
||||
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
|
||||
version.files.all()[0].update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
File.objects.create(
|
||||
version=self.version, platform=amo.PLATFORM_MAC.id)
|
||||
|
|
|
@ -391,7 +391,8 @@ def disable(request, addon_id, addon):
|
|||
addon.update(disabled_by_user=True)
|
||||
if addon.latest_version:
|
||||
addon.latest_version.files.filter(
|
||||
status=amo.STATUS_UNREVIEWED).update(status=amo.STATUS_DISABLED)
|
||||
status=amo.STATUS_AWAITING_REVIEW).update(
|
||||
status=amo.STATUS_DISABLED)
|
||||
addon.update_version()
|
||||
amo.log(amo.LOG.USER_DISABLE, addon)
|
||||
return redirect(addon.get_dev_url('versions'))
|
||||
|
@ -1224,7 +1225,7 @@ def auto_sign_file(file_, is_beta=False):
|
|||
|
||||
if file_.is_experiment: # See bug 1220097.
|
||||
amo.log(amo.LOG.EXPERIMENT_SIGNED, file_)
|
||||
sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)
|
||||
sign_file(file_, settings.SIGNING_SERVER)
|
||||
elif is_beta:
|
||||
# Beta won't be reviewed. They will always get signed, and logged, for
|
||||
# further review if needed.
|
||||
|
@ -1232,8 +1233,7 @@ def auto_sign_file(file_, is_beta=False):
|
|||
amo.log(amo.LOG.BETA_SIGNED_VALIDATION_PASSED, file_)
|
||||
else:
|
||||
amo.log(amo.LOG.BETA_SIGNED_VALIDATION_FAILED, file_)
|
||||
# Beta files always get signed with prelim cert.
|
||||
sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)
|
||||
sign_file(file_, settings.SIGNING_SERVER)
|
||||
elif addon.automated_signing:
|
||||
# Sign automatically without manual review.
|
||||
helper = ReviewHelper(request=None, addon=addon,
|
||||
|
@ -1645,8 +1645,7 @@ def remove_locale(request, addon_id, addon, theme):
|
|||
@dev_required
|
||||
@post_required
|
||||
def request_review(request, addon_id, addon):
|
||||
if amo.STATUS_PUBLIC not in addon.can_request_review(
|
||||
disallow_preliminary_review=True):
|
||||
if amo.STATUS_PUBLIC not in addon.can_request_review():
|
||||
return http.HttpResponseBadRequest()
|
||||
|
||||
addon.update(status=amo.STATUS_NOMINATED)
|
||||
|
|
|
@ -108,7 +108,7 @@ class TestDiscoveryViewList(TestCase):
|
|||
theme_disabled_by_user.update(disabled_by_user=True)
|
||||
addon_factory(
|
||||
id=discopane_items[4].addon_id, type=amo.ADDON_EXTENSION,
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
status=amo.STATUS_NOMINATED)
|
||||
|
||||
response = self.client.get(self.url)
|
||||
assert response.data
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
"homepage": null,
|
||||
"support_email": null,
|
||||
"public_stats": false,
|
||||
"status": 10,
|
||||
"status": 4,
|
||||
"description": null,
|
||||
"default_locale": "en-US",
|
||||
"prerelease": false,
|
||||
|
|
|
@ -209,7 +209,7 @@ class ViewPendingQueue(ViewQueue):
|
|||
|
||||
def base_query(self):
|
||||
q = super(ViewPendingQueue, self).base_query()
|
||||
q['where'].extend(['files.status = %s' % amo.STATUS_UNREVIEWED,
|
||||
q['where'].extend(['files.status = %s' % amo.STATUS_AWAITING_REVIEW,
|
||||
'addons.status = %s' % amo.STATUS_PUBLIC])
|
||||
return q
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@ class TestReviewActions(TestCase):
|
|||
def test_nominated_addon(self):
|
||||
self.addon.update(is_listed=False)
|
||||
actions = self.set_statuses(addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
assert actions['public']['label'] == 'Approve'
|
||||
|
||||
def test_reject(self):
|
||||
reject = self.set_statuses(
|
||||
addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)['reject']['details']
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)['reject']['details']
|
||||
assert force_text(reject).startswith('This will reject this version')
|
||||
|
||||
def test_addon_status_null(self):
|
||||
|
@ -72,12 +72,12 @@ class TestReviewActions(TestCase):
|
|||
# Test with an admin editor.
|
||||
action_allowed_mock.return_value = True
|
||||
status = self.set_statuses(addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
assert 'public' in status.keys()
|
||||
# Test with an non-admin editor.
|
||||
action_allowed_mock.return_value = False
|
||||
status = self.set_statuses(addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
assert 'public' not in status.keys()
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ class TestCannedResponses(TestReviewActions):
|
|||
|
||||
def test_no_app(self):
|
||||
self.set_statuses(addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
form = ReviewForm(
|
||||
{'addon_files': [self.file.pk]},
|
||||
helper=ReviewHelper(request=self.request, addon=self.addon,
|
||||
|
|
|
@ -336,13 +336,13 @@ class TestReviewHelper(TestCase):
|
|||
expected = ['public', 'reject', 'info', 'super', 'comment']
|
||||
assert self.get_review_actions(
|
||||
addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED).keys() == expected
|
||||
file_status=amo.STATUS_AWAITING_REVIEW).keys() == expected
|
||||
|
||||
def test_actions_full_update(self):
|
||||
expected = ['public', 'reject', 'info', 'super', 'comment']
|
||||
assert self.get_review_actions(
|
||||
addon_status=amo.STATUS_PUBLIC,
|
||||
file_status=amo.STATUS_UNREVIEWED).keys() == expected
|
||||
file_status=amo.STATUS_AWAITING_REVIEW).keys() == expected
|
||||
|
||||
def test_actions_full_nonpending(self):
|
||||
expected = ['info', 'super', 'comment']
|
||||
|
@ -448,8 +448,9 @@ class TestReviewHelper(TestCase):
|
|||
mail.outbox = []
|
||||
ActivityLog.objects.for_addons(self.helper.addon).delete()
|
||||
self.addon.update(status=status, is_listed=is_listed)
|
||||
file_status = (amo.STATUS_UNREVIEWED if status == amo.STATUS_NOMINATED
|
||||
else status)
|
||||
file_status = (
|
||||
amo.STATUS_AWAITING_REVIEW if status == amo.STATUS_NOMINATED
|
||||
else status)
|
||||
self.file.update(status=file_status)
|
||||
self.helper = self.get_helper()
|
||||
data = self.get_data().copy()
|
||||
|
@ -529,7 +530,7 @@ class TestReviewHelper(TestCase):
|
|||
|
||||
# Make sure we have no public files
|
||||
for i in self.addon.versions.all():
|
||||
i.files.update(status=amo.STATUS_UNREVIEWED)
|
||||
i.files.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
self.helper.handler.process_public()
|
||||
|
||||
|
@ -608,7 +609,7 @@ class TestReviewHelper(TestCase):
|
|||
# Status unchanged.
|
||||
assert self.addon.status == amo.STATUS_NOMINATED
|
||||
assert self.addon.versions.all()[0].files.all()[0].status == (
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
assert len(mail.outbox) == 0
|
||||
assert self.check_log_count(amo.LOG.APPROVE_VERSION.id) == 0
|
||||
|
@ -678,7 +679,7 @@ class TestReviewHelper(TestCase):
|
|||
|
||||
def test_nomination_to_super_review_and_escalate(self):
|
||||
self.setup_data(amo.STATUS_NOMINATED)
|
||||
self.file.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.file.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.helper.handler.process_super_review()
|
||||
|
||||
assert self.addon.admin_review
|
||||
|
@ -890,9 +891,9 @@ def test_version_status():
|
|||
addon = Addon()
|
||||
version = Version()
|
||||
version.all_files = [File(status=amo.STATUS_PUBLIC),
|
||||
File(status=amo.STATUS_UNREVIEWED)]
|
||||
File(status=amo.STATUS_AWAITING_REVIEW)]
|
||||
assert u'Fully Reviewed,Awaiting Review' == (
|
||||
helpers.version_status(addon, version))
|
||||
|
||||
version.all_files = [File(status=amo.STATUS_UNREVIEWED)]
|
||||
version.all_files = [File(status=amo.STATUS_AWAITING_REVIEW)]
|
||||
assert u'Awaiting Review' == helpers.version_status(addon, version)
|
||||
|
|
|
@ -146,7 +146,7 @@ class TestPendingQueue(TestQueue):
|
|||
|
||||
def new_file(self, name=u'Pending', version=u'1.0',
|
||||
addon_status=amo.STATUS_PUBLIC,
|
||||
file_status=amo.STATUS_UNREVIEWED, **kw):
|
||||
file_status=amo.STATUS_AWAITING_REVIEW, **kw):
|
||||
# Create the addon and everything related. Note that we are cheating,
|
||||
# the addon status might not correspond to the files attached. This is
|
||||
# important not to re-save() attached versions and files afterwards,
|
||||
|
@ -156,7 +156,7 @@ class TestPendingQueue(TestQueue):
|
|||
|
||||
def new_search_ext(self, name, version, **kw):
|
||||
return create_search_ext(name, version,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW,
|
||||
listed=self.listed, **kw)
|
||||
|
||||
def test_waiting_time(self):
|
||||
|
@ -224,13 +224,14 @@ class TestFullReviewQueue(TestQueue):
|
|||
|
||||
def new_file(self, name=u'Nominated', version=u'1.0',
|
||||
addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED, **kw):
|
||||
file_status=amo.STATUS_AWAITING_REVIEW, **kw):
|
||||
return create_addon_file(name, version, addon_status, file_status,
|
||||
listed=self.listed, **kw)
|
||||
|
||||
def new_search_ext(self, name, version, **kw):
|
||||
return create_search_ext(name, version,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_AWAITING_REVIEW,
|
||||
listed=self.listed, **kw)
|
||||
|
||||
def test_waiting_time(self):
|
||||
|
@ -259,7 +260,7 @@ class TestUnlistedAllList(TestCase):
|
|||
|
||||
def new_file(self, name=u'Nominated', version=u'1.0',
|
||||
addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED, **kw):
|
||||
file_status=amo.STATUS_AWAITING_REVIEW, **kw):
|
||||
return create_addon_file(name, version, addon_status, file_status,
|
||||
listed=self.listed, **kw)
|
||||
|
||||
|
@ -267,7 +268,7 @@ class TestUnlistedAllList(TestCase):
|
|||
self.new_file('Public', addon_status=amo.STATUS_PUBLIC,
|
||||
file_status=amo.STATUS_PUBLIC)
|
||||
self.new_file('Nominated', addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.new_file('Deleted', addon_status=amo.STATUS_PUBLIC,
|
||||
file_status=amo.STATUS_PUBLIC)['addon'].delete()
|
||||
assert sorted(q.addon_name for q in self.Queue.objects.all()) == (
|
||||
|
@ -470,7 +471,7 @@ class TestReviewerScore(TestCase):
|
|||
u'AwardBonus',
|
||||
u'1.0',
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_AWAITING_REVIEW,
|
||||
nomination=(datetime.now() - timedelta(days=days, minutes=5))
|
||||
)['addon']
|
||||
self._give_points(user2, bonus_addon, amo.STATUS_NOMINATED)
|
||||
|
|
|
@ -29,8 +29,8 @@ def addon_with_files(db):
|
|||
"""
|
||||
addon = Addon.objects.create(name='My Addon', slug='my-addon')
|
||||
version = Version.objects.create(addon=addon)
|
||||
for status in [amo.STATUS_BETA, amo.STATUS_DISABLED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_UNREVIEWED]:
|
||||
for status in [amo.STATUS_BETA, amo.STATUS_DISABLED,
|
||||
amo.STATUS_AWAITING_REVIEW, amo.STATUS_AWAITING_REVIEW]:
|
||||
File.objects.create(version=version, status=status)
|
||||
return addon
|
||||
|
||||
|
@ -41,20 +41,20 @@ def addon_with_files(db):
|
|||
[
|
||||
# New addon request full.
|
||||
# scenario0: should succeed, files approved.
|
||||
('process_public', amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
('process_public', amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
helpers.ReviewAddon, 'nominated', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_PUBLIC),
|
||||
# scenario1: should succeed, files rejected.
|
||||
('process_sandbox', amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
('process_sandbox', amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
helpers.ReviewAddon, 'nominated', amo.STATUS_NULL,
|
||||
amo.STATUS_DISABLED),
|
||||
|
||||
# Full addon with a new file.
|
||||
# scenario2: should succeed, files approved.
|
||||
('process_public', amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED,
|
||||
('process_public', amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW,
|
||||
helpers.ReviewFiles, 'pending', amo.STATUS_PUBLIC, amo.STATUS_PUBLIC),
|
||||
# scenario3: should succeed, files rejected.
|
||||
('process_sandbox', amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED,
|
||||
('process_sandbox', amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW,
|
||||
helpers.ReviewFiles, 'pending', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_DISABLED),
|
||||
])
|
||||
|
@ -66,7 +66,7 @@ def test_review_scenario(mock_request, addon_with_files, review_action,
|
|||
addon.update(status=addon_status)
|
||||
version = addon.versions.get()
|
||||
version.files.filter(
|
||||
status=amo.STATUS_UNREVIEWED).update(status=file_status)
|
||||
status=amo.STATUS_AWAITING_REVIEW).update(status=file_status)
|
||||
# Get the review helper.
|
||||
helper = helpers.ReviewHelper(mock_request, addon, version)
|
||||
assert isinstance(helper.handler, review_class)
|
||||
|
|
|
@ -491,10 +491,10 @@ class TestHome(EditorTest):
|
|||
|
||||
create_addon_file('No admin review', version_str='1.0',
|
||||
addon_status=amo.STATUS_NOMINATED,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
create_addon_file('Admin review', version_str='1.0',
|
||||
addon_status=amo.STATUS_NOMINATED, admin_review=True,
|
||||
file_status=amo.STATUS_UNREVIEWED)
|
||||
file_status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
doc = pq(self.client.get(self.url).content)
|
||||
tooltip = doc('.editor-stats-table').eq(0).find('.waiting_new')
|
||||
|
@ -579,12 +579,12 @@ class TestHome(EditorTest):
|
|||
# Make sure the listed addons are displayed in the listed stats, and
|
||||
# that the unlisted addons are listed in the unlisted stats.
|
||||
# Create one listed, and two unlisted.
|
||||
create_addon_file('listed', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED)
|
||||
create_addon_file('listed', '0.1', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
create_addon_file('unlisted 1', '0.1', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED, listed=False)
|
||||
amo.STATUS_AWAITING_REVIEW, listed=False)
|
||||
create_addon_file('unlisted 2', '0.1', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED, listed=False)
|
||||
amo.STATUS_AWAITING_REVIEW, listed=False)
|
||||
|
||||
selector = '.editor-stats-title' # The new addons stats header.
|
||||
|
||||
|
@ -618,22 +618,22 @@ class QueueTest(EditorTest):
|
|||
('Pending One', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_PUBLIC,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Pending Two', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_PUBLIC,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Nominated One', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Nominated Two', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Public', {
|
||||
'version_str': '0.1',
|
||||
|
@ -863,7 +863,7 @@ class TestQueueBasics(QueueTest):
|
|||
|
||||
def test_flags_jetpack(self):
|
||||
ad = create_addon_file('Jetpack', '0.1', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
ad_file = ad['version'].files.all()[0]
|
||||
ad_file.update(jetpack_version=1.2)
|
||||
|
||||
|
@ -877,7 +877,7 @@ class TestQueueBasics(QueueTest):
|
|||
|
||||
def test_flags_requires_restart(self):
|
||||
ad = create_addon_file('Some Add-on', '0.1', amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_AWAITING_REVIEW,
|
||||
file_kw={'no_restart': False})
|
||||
|
||||
r = self.client.get(reverse('editors.queue_nominated'))
|
||||
|
@ -892,7 +892,8 @@ class TestQueueBasics(QueueTest):
|
|||
def test_flags_no_restart(self):
|
||||
# create_addon_file() creates restartless files by default.
|
||||
ad = create_addon_file('Restartless', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
r = self.client.get(reverse('editors.queue_nominated'))
|
||||
|
||||
|
@ -973,10 +974,10 @@ class TestUnlistedQueueBasics(TestQueueBasics):
|
|||
# that the unlisted addons are listed in the unlisted queue.
|
||||
listed = create_addon_file('listed', '0.1',
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED)['addon']
|
||||
amo.STATUS_AWAITING_REVIEW)['addon']
|
||||
unlisted = create_addon_file('unlisted', '0.1',
|
||||
amo.STATUS_NOMINATED,
|
||||
amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_AWAITING_REVIEW,
|
||||
listed=False)['addon']
|
||||
|
||||
# Listed addon is displayed in the listed queue.
|
||||
|
@ -1442,53 +1443,53 @@ class BaseTestQueueSearch(SearchTest):
|
|||
('Not Admin Reviewed', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Another Not Admin Reviewed', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
('Admin Reviewed', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'admin_review': True,
|
||||
}),
|
||||
('Justin Bieber Theme', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'addon_type': amo.ADDON_THEME,
|
||||
}),
|
||||
('Justin Bieber Search Bar', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'addon_type': amo.ADDON_SEARCH,
|
||||
}),
|
||||
('Bieber For Mobile', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'application': amo.MOBILE,
|
||||
}),
|
||||
('Linux Widget', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'platform': amo.PLATFORM_LINUX,
|
||||
}),
|
||||
('Mac Widget', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'platform': amo.PLATFORM_MAC,
|
||||
}),
|
||||
('Deleted', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_DELETED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
}),
|
||||
])
|
||||
results = {}
|
||||
|
@ -1605,7 +1606,7 @@ class BaseTestQueueSearch(SearchTest):
|
|||
|
||||
def test_search_by_app_version(self):
|
||||
d = create_addon_file('Bieber For Mobile 4.0b2pre', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
application=amo.MOBILE, listed=self.listed)
|
||||
max = AppVersion.objects.get(application=amo.MOBILE.id,
|
||||
version='4.0b2pre')
|
||||
|
@ -1699,7 +1700,7 @@ class TestQueueSearch(BaseTestQueueSearch):
|
|||
def test_preserve_multi_platform_files(self):
|
||||
for plat in (amo.PLATFORM_WIN, amo.PLATFORM_MAC):
|
||||
create_addon_file('Multi Platform', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
platform=plat)
|
||||
r = self.search(platform_ids=[amo.PLATFORM_WIN.id])
|
||||
assert r.status_code == 200
|
||||
|
@ -1710,7 +1711,7 @@ class TestQueueSearch(BaseTestQueueSearch):
|
|||
|
||||
def test_preserve_single_platform_files(self):
|
||||
create_addon_file('Windows', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
platform=amo.PLATFORM_WIN)
|
||||
r = self.search(platform_ids=[amo.PLATFORM_WIN.id])
|
||||
doc = pq(r.content)
|
||||
|
@ -1727,7 +1728,7 @@ class TestQueueSearch(BaseTestQueueSearch):
|
|||
self.generate_files(['Bieber For Mobile', 'Linux Widget'])
|
||||
for app in (amo.MOBILE, amo.FIREFOX):
|
||||
create_addon_file('Multi Application', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
application=app, listed=self.listed)
|
||||
|
||||
r = self.search(application_id=[amo.MOBILE.id])
|
||||
|
@ -1823,9 +1824,9 @@ class TestQueueSearchVersionSpecific(SearchTest):
|
|||
super(TestQueueSearchVersionSpecific, self).setUp()
|
||||
self.url = reverse('editors.queue_nominated')
|
||||
create_addon_file('Not Admin Reviewed', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW)
|
||||
create_addon_file('Justin Bieber Theme', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW,
|
||||
addon_type=amo.ADDON_THEME)
|
||||
self.bieber = Version.objects.filter(
|
||||
addon__name__localized_string='Justin Bieber Theme')
|
||||
|
@ -2017,7 +2018,7 @@ class TestReview(ReviewBase):
|
|||
|
||||
def test_item_history(self):
|
||||
self.addon_file(u'something', u'0.2', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
assert self.addon.versions.count() == 1
|
||||
self.review_version(self.version, self.url)
|
||||
|
||||
|
@ -2064,7 +2065,8 @@ class TestReview(ReviewBase):
|
|||
|
||||
for i, version in enumerate(versions):
|
||||
a = create_addon_file(self.addon.name, version['version'],
|
||||
amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_PUBLIC,
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
v = a['version']
|
||||
v.update(created=v.created + timedelta(days=i))
|
||||
|
@ -2102,7 +2104,7 @@ class TestReview(ReviewBase):
|
|||
def test_item_history_compat_ordered(self):
|
||||
""" Make sure that apps in compatibility are ordered. """
|
||||
self.addon_file(u'something', u'0.2', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
av = AppVersion.objects.all()[0]
|
||||
v = self.addon.versions.all()[0]
|
||||
|
@ -2147,7 +2149,7 @@ class TestReview(ReviewBase):
|
|||
def test_item_history_comment(self):
|
||||
# Add Comment.
|
||||
self.addon_file(u'something', u'0.1', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
self.client.post(self.url, {'action': 'comment',
|
||||
'comments': 'hello sailor'})
|
||||
|
||||
|
@ -2297,7 +2299,7 @@ class TestReview(ReviewBase):
|
|||
"""
|
||||
# Add a new version to the add-on.
|
||||
self.addon_file(u'something', u'0.2', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
assert self.addon.versions.count() == 1
|
||||
|
||||
|
@ -2360,7 +2362,7 @@ class TestReview(ReviewBase):
|
|||
|
||||
@patch('olympia.editors.helpers.sign_file')
|
||||
def review_version(self, version, url, mock_sign):
|
||||
version.files.all()[0].update(status=amo.STATUS_UNREVIEWED)
|
||||
version.files.all()[0].update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
data = dict(action='public', operating_systems='win',
|
||||
applications='something', comments='something')
|
||||
self.client.post(url, data)
|
||||
|
@ -2576,7 +2578,7 @@ class TestReview(ReviewBase):
|
|||
|
||||
@patch('olympia.editors.helpers.sign_file')
|
||||
def test_admin_flagged_addon_actions_as_admin(self, mock_sign_file):
|
||||
self.version.files.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.version.files.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.addon.update(admin_review=True, status=amo.STATUS_NOMINATED)
|
||||
self.login_as_admin()
|
||||
response = self.client.post(self.url, self.get_dict(action='public'),
|
||||
|
@ -2589,7 +2591,7 @@ class TestReview(ReviewBase):
|
|||
assert mock_sign_file.called
|
||||
|
||||
def test_admin_flagged_addon_actions_as_editor(self):
|
||||
self.version.files.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.version.files.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.addon.update(admin_review=True, status=amo.STATUS_NOMINATED)
|
||||
self.login_as_editor()
|
||||
response = self.client.post(self.url, self.get_dict(action='public'))
|
||||
|
@ -2599,7 +2601,7 @@ class TestReview(ReviewBase):
|
|||
addon = self.get_addon()
|
||||
assert addon.status == amo.STATUS_NOMINATED
|
||||
assert addon.latest_version.files.all()[0].status == (
|
||||
amo.STATUS_UNREVIEWED)
|
||||
amo.STATUS_AWAITING_REVIEW)
|
||||
assert response.context['form'].errors['action'] == (
|
||||
[u'Select a valid choice. public is not one of the available '
|
||||
u'choices.'])
|
||||
|
@ -2674,7 +2676,7 @@ class TestReviewPending(ReviewBase):
|
|||
def setUp(self):
|
||||
super(TestReviewPending, self).setUp()
|
||||
self.file = File.objects.create(version=self.version,
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.addon.update(status=amo.STATUS_PUBLIC)
|
||||
|
||||
def pending_dict(self):
|
||||
|
@ -2684,7 +2686,8 @@ class TestReviewPending(ReviewBase):
|
|||
def test_pending_to_public(self, mock_sign):
|
||||
statuses = (self.version.files.values_list('status', flat=True)
|
||||
.order_by('status'))
|
||||
assert list(statuses) == [amo.STATUS_UNREVIEWED, amo.STATUS_PUBLIC]
|
||||
assert list(statuses) == [
|
||||
amo.STATUS_AWAITING_REVIEW, amo.STATUS_PUBLIC]
|
||||
|
||||
response = self.client.post(self.url, self.pending_dict())
|
||||
assert self.get_addon().status == amo.STATUS_PUBLIC
|
||||
|
@ -2701,7 +2704,8 @@ class TestReviewPending(ReviewBase):
|
|||
self.addon.update(is_listed=False)
|
||||
statuses = (self.version.files.values_list('status', flat=True)
|
||||
.order_by('status'))
|
||||
assert list(statuses) == [amo.STATUS_UNREVIEWED, amo.STATUS_PUBLIC]
|
||||
assert list(statuses) == [
|
||||
amo.STATUS_AWAITING_REVIEW, amo.STATUS_PUBLIC]
|
||||
|
||||
self.login_as_admin()
|
||||
response = self.client.post(self.url, self.pending_dict())
|
||||
|
@ -2724,7 +2728,7 @@ class TestReviewPending(ReviewBase):
|
|||
status=amo.STATUS_DISABLED,
|
||||
filename='file_disabled.xpi')
|
||||
unreviewed = File.objects.create(version=self.version,
|
||||
status=amo.STATUS_UNREVIEWED,
|
||||
status=amo.STATUS_AWAITING_REVIEW,
|
||||
filename='file_unreviewed.xpi')
|
||||
response = self.client.get(self.url, self.pending_dict())
|
||||
doc = pq(response.content)
|
||||
|
@ -2742,7 +2746,7 @@ class TestReviewPending(ReviewBase):
|
|||
disabled = File.objects.create(version=self.version,
|
||||
status=amo.STATUS_DISABLED)
|
||||
unreviewed = File.objects.create(version=self.version,
|
||||
status=amo.STATUS_UNREVIEWED)
|
||||
status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.login_as_admin()
|
||||
response = self.client.post(self.url, self.pending_dict())
|
||||
self.assert3xx(response, reverse('editors.queue_pending'))
|
||||
|
@ -2824,7 +2828,7 @@ class TestStatusFile(ReviewBase):
|
|||
assert pq(r.content)('#review-files .file-info div').text() == expected
|
||||
|
||||
def test_status_full(self):
|
||||
self.get_file().update(status=amo.STATUS_UNREVIEWED)
|
||||
self.get_file().update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
for status in [amo.STATUS_NOMINATED, amo.STATUS_PUBLIC]:
|
||||
self.addon.update(status=status)
|
||||
self.check_status('Awaiting Review')
|
||||
|
@ -3015,13 +3019,13 @@ class TestLimitedReviewerQueue(QueueTest, LimitedReviewerBase):
|
|||
('Nominated new', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'nomination': datetime.now()
|
||||
}),
|
||||
('Nominated old', {
|
||||
'version_str': '0.1',
|
||||
'addon_status': amo.STATUS_NOMINATED,
|
||||
'file_status': amo.STATUS_UNREVIEWED,
|
||||
'file_status': amo.STATUS_AWAITING_REVIEW,
|
||||
'nomination': datetime.now() - timedelta(days=1)
|
||||
}),
|
||||
])
|
||||
|
@ -3052,7 +3056,7 @@ class TestLimitedReviewerReview(ReviewBase, LimitedReviewerBase):
|
|||
def test_new_addon_review_action_as_limited_editor(self):
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
self.version.update(nomination=datetime.now())
|
||||
self.version.files.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.version.files.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
response = self.client.post(self.url, self.get_dict(action='public'))
|
||||
assert response.status_code == 200 # Form error.
|
||||
# The add-on status must not change as limited reviewers are not
|
||||
|
@ -3064,7 +3068,7 @@ class TestLimitedReviewerReview(ReviewBase, LimitedReviewerBase):
|
|||
|
||||
@patch('olympia.editors.helpers.sign_file')
|
||||
def test_old_addon_review_action_as_limited_editor(self, mock_sign_file):
|
||||
self.version.files.update(status=amo.STATUS_UNREVIEWED)
|
||||
self.version.files.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
self.version.update(nomination=datetime.now() - timedelta(days=1))
|
||||
self.addon.update(status=amo.STATUS_NOMINATED)
|
||||
response = self.client.post(self.url, self.get_dict(action='public'),
|
||||
|
|
|
@ -502,7 +502,7 @@ def queue_moderated(request):
|
|||
Q(addon__is_listed=False) |
|
||||
Q(reviewflag__isnull=True))
|
||||
.filter(editorreview=1,
|
||||
addon__status__in=amo.LISTED_STATUSES)
|
||||
addon__status__in=amo.VALID_ADDON_STATUSES)
|
||||
.order_by('reviewflag__created'))
|
||||
|
||||
page = paginate(request, rf, per_page=20)
|
||||
|
|
|
@ -52,8 +52,8 @@ class File(OnChangeMixin, ModelBase):
|
|||
# any other way.
|
||||
original_hash = models.CharField(max_length=255, default='')
|
||||
jetpack_version = models.CharField(max_length=10, null=True)
|
||||
status = models.PositiveSmallIntegerField(choices=STATUS_CHOICES.items(),
|
||||
default=amo.STATUS_UNREVIEWED)
|
||||
status = models.PositiveSmallIntegerField(
|
||||
choices=STATUS_CHOICES.items(), default=amo.STATUS_AWAITING_REVIEW)
|
||||
datestatuschanged = models.DateTimeField(null=True, auto_now_add=True)
|
||||
no_restart = models.BooleanField(default=False)
|
||||
strict_compatibility = models.BooleanField(default=False)
|
||||
|
|
|
@ -187,10 +187,10 @@ class TestFile(TestCase, amo.tests.AMOPaths):
|
|||
@mock.patch('olympia.files.models.File.copy_to_mirror')
|
||||
def test_copy_to_mirror_on_status_change(self, copy_mock):
|
||||
|
||||
assert amo.STATUS_UNREVIEWED not in amo.MIRROR_STATUSES
|
||||
assert amo.STATUS_AWAITING_REVIEW not in amo.MIRROR_STATUSES
|
||||
|
||||
f = File.objects.get(pk=67442)
|
||||
f.status = amo.STATUS_UNREVIEWED
|
||||
f.status = amo.STATUS_AWAITING_REVIEW
|
||||
f.save()
|
||||
assert not copy_mock.called
|
||||
copy_mock.reset_mock()
|
||||
|
@ -200,7 +200,7 @@ class TestFile(TestCase, amo.tests.AMOPaths):
|
|||
f.status = status
|
||||
f.save()
|
||||
assert copy_mock.called, "Copy not called"
|
||||
f.status = amo.STATUS_UNREVIEWED
|
||||
f.status = amo.STATUS_AWAITING_REVIEW
|
||||
f.save()
|
||||
copy_mock.reset_mock()
|
||||
|
||||
|
@ -999,15 +999,6 @@ class TestFileFromUpload(UploadTest):
|
|||
f = File.from_upload(upload, self.version, self.platform)
|
||||
assert f.size == 675
|
||||
|
||||
def test_beta_version_non_public(self):
|
||||
# Only public add-ons can get beta versions.
|
||||
upload = self.upload('beta-extension')
|
||||
d = parse_addon(upload.path)
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
assert self.addon.status == amo.STATUS_LITE
|
||||
f = File.from_upload(upload, self.version, self.platform, parse_data=d)
|
||||
assert f.status == amo.STATUS_UNREVIEWED
|
||||
|
||||
def test_public_to_beta(self):
|
||||
upload = self.upload('beta-extension')
|
||||
d = parse_addon(upload.path)
|
||||
|
@ -1023,25 +1014,7 @@ class TestFileFromUpload(UploadTest):
|
|||
self.addon.update(status=amo.STATUS_PUBLIC)
|
||||
assert self.addon.status == amo.STATUS_PUBLIC
|
||||
f = File.from_upload(upload, self.version, self.platform, parse_data=d)
|
||||
assert f.status == amo.STATUS_UNREVIEWED
|
||||
|
||||
def test_lite_to_unreviewed(self):
|
||||
upload = self.upload('extension')
|
||||
d = parse_addon(upload.path)
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
assert self.addon.status == amo.STATUS_LITE
|
||||
f = File.from_upload(upload, self.version, self.platform, parse_data=d)
|
||||
assert f.status == amo.STATUS_UNREVIEWED
|
||||
|
||||
def test_litenominated_to_unreviewed(self):
|
||||
upload = self.upload('extension')
|
||||
d = parse_addon(upload.path)
|
||||
with mock.patch('olympia.addons.models.Addon.update_status'):
|
||||
# mock update_status because it doesn't like Addons without files.
|
||||
self.addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
assert self.addon.status == amo.STATUS_LITE_AND_NOMINATED
|
||||
f = File.from_upload(upload, self.version, self.platform, parse_data=d)
|
||||
assert f.status == amo.STATUS_UNREVIEWED
|
||||
assert f.status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
def test_file_hash_paranoia(self):
|
||||
upload = self.upload('extension')
|
||||
|
|
|
@ -105,8 +105,8 @@ class TestFindJetpacks(TestCase):
|
|||
new_file = File.objects.create(version=v, jetpack_version='1.0')
|
||||
Version.objects.create(addon_id=3615)
|
||||
new_file2 = File.objects.create(version=v, jetpack_version='1.0')
|
||||
assert new_file.status == amo.STATUS_UNREVIEWED
|
||||
assert new_file2.status == amo.STATUS_UNREVIEWED
|
||||
assert new_file.status == amo.STATUS_AWAITING_REVIEW
|
||||
assert new_file2.status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
files = utils.find_jetpacks('1.0', '1.1')
|
||||
assert files == [self.file, new_file, new_file2]
|
||||
|
|
|
@ -111,7 +111,7 @@ class FilesBase(object):
|
|||
self.file_viewer.extract()
|
||||
self.client.logout()
|
||||
|
||||
for status in amo.UNREVIEWED_STATUSES:
|
||||
for status in amo.UNREVIEWED_FILE_STATUSES:
|
||||
self.addon.update(status=status)
|
||||
self.check_urls(403)
|
||||
|
||||
|
|
|
@ -704,7 +704,7 @@ def find_jetpacks(minver, maxver):
|
|||
Files that should be upgraded will have needs_upgrade=True.
|
||||
"""
|
||||
from .models import File
|
||||
statuses = amo.VALID_STATUSES
|
||||
statuses = amo.VALID_ADDON_STATUSES
|
||||
files = (File.objects.filter(jetpack_version__isnull=False,
|
||||
version__addon__auto_repackage=True,
|
||||
version__addon__status__in=statuses,
|
||||
|
|
|
@ -89,7 +89,7 @@ class UtilsTest(TestCase):
|
|||
def test_no_contrib_info_until_approved(self):
|
||||
self.a.wants_contributions = True
|
||||
self.a.suggested_amount = 5
|
||||
self.a.status = amo.STATUS_LITE
|
||||
self.a.status = amo.STATUS_NOMINATED
|
||||
self.a.paypal_id = 'alice@example.com'
|
||||
self.a.save()
|
||||
d = addon_to_dict(self.a)
|
||||
|
@ -469,7 +469,7 @@ class APITest(TestCase):
|
|||
self.assertUrlEqual(url, needle)
|
||||
|
||||
def test_no_contribs_until_approved(self):
|
||||
Addon.objects.filter(id=4664).update(status=amo.STATUS_LITE)
|
||||
Addon.objects.filter(id=4664).update(status=amo.STATUS_NOMINATED)
|
||||
response = make_call('addon/4664', version=1.5)
|
||||
self.assertNotContains(response, 'contribution_data')
|
||||
|
||||
|
@ -826,7 +826,7 @@ class TestGuidSearch(TestCase):
|
|||
set([a.attrib['id'] for a in pq(r.content)('addon')]))
|
||||
|
||||
def test_block_nonpublic(self):
|
||||
Addon.objects.filter(id=6113).update(status=amo.STATUS_UNREVIEWED)
|
||||
Addon.objects.filter(id=6113).update(status=amo.STATUS_NOMINATED)
|
||||
r = make_call(self.good)
|
||||
assert set(['3615']) == (
|
||||
set([a.attrib['id'] for a in pq(r.content)('addon')]))
|
||||
|
|
|
@ -38,8 +38,7 @@ ERROR = 'error'
|
|||
OUT_OF_DATE = ugettext_lazy(
|
||||
u"The API version, {0:.1f}, you are using is not valid. "
|
||||
u"Please upgrade to the current version {1:.1f} API.")
|
||||
SEARCHABLE_STATUSES = (amo.STATUS_PUBLIC, amo.STATUS_LITE,
|
||||
amo.STATUS_LITE_AND_NOMINATED)
|
||||
SEARCHABLE_STATUSES = (amo.STATUS_PUBLIC, )
|
||||
|
||||
xml_env = jingo.get_env().overlay()
|
||||
old_finalize = xml_env.finalize
|
||||
|
|
|
@ -47,7 +47,7 @@ def supports_firefox(file_obj):
|
|||
|
||||
|
||||
def get_endpoint(server):
|
||||
"""Get the endpoint to sign the file, either the full or prelim one."""
|
||||
"""Get the endpoint to sign the file."""
|
||||
if not server: # Setting is empty, signing isn't enabled.
|
||||
return
|
||||
|
||||
|
|
|
@ -157,10 +157,7 @@ def sign_addons(addon_ids, force=False, **kw):
|
|||
# Need to bump the version (modify manifest file)
|
||||
# before the file is signed.
|
||||
update_version_number(file_obj, bumped_version_number)
|
||||
if file_obj.status == amo.STATUS_PUBLIC:
|
||||
server = settings.SIGNING_SERVER
|
||||
else:
|
||||
server = settings.PRELIMINARY_SIGNING_SERVER
|
||||
server = settings.SIGNING_SERVER
|
||||
signed = bool(sign_file(file_obj, server))
|
||||
if signed: # Bump the version number if at least one signed.
|
||||
signed_at_least_a_file = True
|
||||
|
|
|
@ -21,8 +21,7 @@ from olympia.lib.crypto import packaged, tasks
|
|||
from olympia.versions.compare import version_int
|
||||
|
||||
|
||||
@override_settings(SIGNING_SERVER='http://full',
|
||||
PRELIMINARY_SIGNING_SERVER='http://prelim')
|
||||
@override_settings(SIGNING_SERVER='http://full')
|
||||
class TestPackaged(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -161,25 +160,14 @@ class TestPackaged(TestCase):
|
|||
|
||||
def test_get_endpoint(self):
|
||||
assert self.addon.status == amo.STATUS_PUBLIC
|
||||
with self.settings(PRELIMINARY_SIGNING_SERVER=''):
|
||||
assert packaged.get_endpoint(
|
||||
settings.SIGNING_SERVER).startswith('http://full')
|
||||
self.addon.update(status=amo.STATUS_LITE)
|
||||
with self.settings(SIGNING_SERVER=''):
|
||||
assert packaged.get_endpoint(
|
||||
settings.PRELIMINARY_SIGNING_SERVER).startswith(
|
||||
'http://prelim')
|
||||
assert packaged.get_endpoint(
|
||||
settings.SIGNING_SERVER).startswith('http://full')
|
||||
|
||||
def test_no_server_full(self):
|
||||
with self.settings(SIGNING_SERVER=''):
|
||||
packaged.sign_file(self.file_, settings.SIGNING_SERVER)
|
||||
self.assert_not_signed()
|
||||
|
||||
def test_no_server_prelim(self):
|
||||
with self.settings(PRELIMINARY_SIGNING_SERVER=''):
|
||||
packaged.sign_file(self.file_, settings.PRELIMINARY_SIGNING_SERVER)
|
||||
self.assert_not_signed()
|
||||
|
||||
def test_sign_file(self):
|
||||
self.assert_not_signed()
|
||||
packaged.sign_file(self.file_, settings.SIGNING_SERVER)
|
||||
|
@ -333,8 +321,8 @@ class TestTasks(TestCase):
|
|||
@mock.patch('olympia.lib.crypto.tasks.sign_file')
|
||||
def test_no_bump_unreviewed(self, mock_sign_file):
|
||||
"""Don't bump nor sign unreviewed files."""
|
||||
for status in (amo.UNREVIEWED_STATUSES + (amo.STATUS_BETA,)):
|
||||
self.file_.update(status=amo.STATUS_UNREVIEWED)
|
||||
for status in (amo.UNREVIEWED_FILE_STATUSES + (amo.STATUS_BETA,)):
|
||||
self.file_.update(status=status)
|
||||
fpath = 'src/olympia/files/fixtures/files/jetpack.xpi'
|
||||
with amo.tests.copy_file(fpath, self.file_.file_path):
|
||||
file_hash = self.file_.generate_hash()
|
||||
|
@ -390,17 +378,6 @@ class TestTasks(TestCase):
|
|||
mock_sign_file.assert_called_with(
|
||||
self.file_, settings.SIGNING_SERVER)
|
||||
|
||||
@mock.patch('olympia.lib.crypto.tasks.sign_file')
|
||||
def test_sign_prelim(self, mock_sign_file):
|
||||
"""Use the prelim signing server if files aren't fully reviewed."""
|
||||
self.file_.update(status=amo.STATUS_LITE)
|
||||
with amo.tests.copy_file(
|
||||
'src/olympia/files/fixtures/files/jetpack.xpi',
|
||||
self.file_.file_path):
|
||||
tasks.sign_addons([self.addon.pk])
|
||||
mock_sign_file.assert_called_with(
|
||||
self.file_, settings.PRELIMINARY_SIGNING_SERVER)
|
||||
|
||||
@mock.patch('olympia.lib.crypto.tasks.sign_file')
|
||||
def test_sign_supported_applications(self, mock_sign_file):
|
||||
"""Make sure we sign for all supported applications."""
|
||||
|
|
|
@ -1495,8 +1495,6 @@ DEFAULT_FILE_STORAGE = 'olympia.amo.utils.LocalFileStorage'
|
|||
|
||||
# This is the signing server for signing fully reviewed files.
|
||||
SIGNING_SERVER = ''
|
||||
# This is the signing server for signing preliminary reviewed files.
|
||||
PRELIMINARY_SIGNING_SERVER = ''
|
||||
# And how long we'll give the server to respond.
|
||||
SIGNING_SERVER_TIMEOUT = 10
|
||||
# Hotfix addons (don't sign those, they're already signed by Mozilla.
|
||||
|
|
|
@ -653,7 +653,7 @@ class TestPersonaSearch(SearchBase):
|
|||
def _generate_personas(self):
|
||||
# Add some public personas.
|
||||
self.personas = []
|
||||
for status in amo.REVIEWED_STATUSES:
|
||||
for status in [amo.STATUS_PUBLIC] * 3:
|
||||
addon = amo.tests.addon_factory(type=amo.ADDON_PERSONA,
|
||||
status=status)
|
||||
self.personas.append(addon)
|
||||
|
@ -1136,20 +1136,11 @@ class TestGenericAjaxSearch(TestAjaxSearch):
|
|||
def test_ajax_search_by_bad_id(self):
|
||||
self.search_addons('q=999', [])
|
||||
|
||||
def test_ajax_search_unreviewed_by_id(self):
|
||||
def test_ajax_search_nominated_by_id(self):
|
||||
addon = Addon.objects.all()[3]
|
||||
addon.update(status=amo.STATUS_UNREVIEWED)
|
||||
addon.update(status=amo.STATUS_NOMINATED)
|
||||
self.search_addons('q=999', [])
|
||||
|
||||
def test_ajax_search_lite_reviewed_by_id(self):
|
||||
addon = Addon.objects.all()[3]
|
||||
addon.update(status=amo.STATUS_LITE)
|
||||
q = 'q=%s' % addon.id
|
||||
self.search_addons(q, [addon])
|
||||
|
||||
addon.update(status=amo.STATUS_LITE_AND_NOMINATED)
|
||||
self.search_addons(q, [addon])
|
||||
|
||||
def test_ajax_search_user_disabled_by_id(self):
|
||||
addon = Addon.objects.filter(disabled_by_user=True)[0]
|
||||
self.search_addons('q=%s' % addon.id, [])
|
||||
|
@ -1167,14 +1158,14 @@ class TestGenericAjaxSearch(TestAjaxSearch):
|
|||
def test_ajax_search_personas_by_id(self):
|
||||
addon = Addon.objects.all()[3]
|
||||
addon.update(type=amo.ADDON_PERSONA)
|
||||
addon.update(status=amo.STATUS_LITE)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
Persona.objects.create(persona_id=addon.id, addon_id=addon.id)
|
||||
self.search_addons('q=%s' % addon.id, [addon])
|
||||
|
||||
def test_ajax_search_by_name(self):
|
||||
addon = amo.tests.addon_factory(
|
||||
name='uniqueaddon',
|
||||
status=amo.STATUS_LITE,
|
||||
status=amo.STATUS_PUBLIC,
|
||||
type=amo.ADDON_EXTENSION,
|
||||
)
|
||||
self._addons.append(addon)
|
||||
|
|
|
@ -11,7 +11,6 @@ from django.utils import translation
|
|||
|
||||
import mock
|
||||
from rest_framework.response import Response
|
||||
from waffle.testutils import override_flag
|
||||
|
||||
from olympia import amo
|
||||
from olympia.access.models import Group, GroupUser
|
||||
|
@ -167,7 +166,7 @@ class TestUploadVersion(BaseUploadVersionCase):
|
|||
version = qs.get()
|
||||
assert version.addon.guid == self.guid
|
||||
assert version.version == '3.0'
|
||||
assert version.statuses[0][1] == amo.STATUS_UNREVIEWED
|
||||
assert version.statuses[0][1] == amo.STATUS_AWAITING_REVIEW
|
||||
assert version.addon.status == amo.STATUS_PUBLIC
|
||||
self.auto_sign_version.assert_called_with(version, is_beta=False)
|
||||
|
||||
|
@ -245,7 +244,7 @@ class TestUploadVersion(BaseUploadVersionCase):
|
|||
version = qs.get()
|
||||
assert version.addon.guid == self.guid
|
||||
assert version.version == version_string
|
||||
assert version.statuses[0][1] == amo.STATUS_UNREVIEWED
|
||||
assert version.statuses[0][1] == amo.STATUS_AWAITING_REVIEW
|
||||
assert version.addon.status == amo.STATUS_PUBLIC
|
||||
assert not version.is_beta
|
||||
self.auto_sign_version.assert_called_with(version, is_beta=False)
|
||||
|
@ -289,43 +288,6 @@ class TestUploadVersion(BaseUploadVersionCase):
|
|||
assert response.status_code == 400
|
||||
|
||||
|
||||
@override_flag('no-prelim-review', active=True)
|
||||
class TestUploadVersionNoPrelim(TestUploadVersion):
|
||||
|
||||
def test_addon_does_not_exist(self):
|
||||
guid = '@create-version'
|
||||
qs = Addon.unfiltered.filter(guid=guid)
|
||||
assert not qs.exists()
|
||||
response = self.request('PUT', addon=guid, version='1.0')
|
||||
assert response.status_code == 201
|
||||
assert qs.exists()
|
||||
addon = qs.get()
|
||||
assert addon.has_author(self.user)
|
||||
assert not addon.is_listed
|
||||
assert addon.status == amo.STATUS_NOMINATED
|
||||
self.auto_sign_version.assert_called_with(
|
||||
addon.latest_version, is_beta=False)
|
||||
|
||||
def test_version_added_is_experiment(self):
|
||||
self.grant_permission(self.user, 'Experiments:submit')
|
||||
guid = 'experiment@xpi'
|
||||
qs = Addon.unfiltered.filter(guid=guid)
|
||||
assert not qs.exists()
|
||||
response = self.request(
|
||||
'PUT',
|
||||
addon=guid, version='0.1',
|
||||
filename='src/olympia/files/fixtures/files/'
|
||||
'telemetry_experiment.xpi')
|
||||
assert response.status_code == 201
|
||||
assert qs.exists()
|
||||
addon = qs.get()
|
||||
assert addon.has_author(self.user)
|
||||
assert not addon.is_listed
|
||||
assert addon.status == amo.STATUS_NOMINATED
|
||||
self.auto_sign_version.assert_called_with(
|
||||
addon.latest_version, is_beta=False)
|
||||
|
||||
|
||||
class TestUploadVersionWebextension(BaseUploadVersionCase):
|
||||
def setUp(self):
|
||||
super(TestUploadVersionWebextension, self).setUp()
|
||||
|
|
|
@ -228,9 +228,6 @@ def _get_daily_jobs(date=None):
|
|||
# move from sandbox -> public
|
||||
if date == (datetime.date.today() - datetime.timedelta(days=1)):
|
||||
stats.update({
|
||||
'addon_count_experimental': Addon.objects.filter(
|
||||
created__lte=date, status=amo.STATUS_UNREVIEWED,
|
||||
disabled_by_user=0).count,
|
||||
'addon_count_nominated': Addon.objects.filter(
|
||||
created__lte=date, status=amo.STATUS_NOMINATED,
|
||||
disabled_by_user=0).count,
|
||||
|
|
|
@ -5,7 +5,7 @@ import multidb
|
|||
from celery.task.sets import TaskSet
|
||||
|
||||
import cronjobs
|
||||
from olympia.amo import VALID_STATUSES
|
||||
from olympia.amo import VALID_ADDON_STATUSES
|
||||
from olympia.amo.utils import chunked
|
||||
|
||||
from .models import UserProfile
|
||||
|
@ -36,7 +36,7 @@ def update_user_ratings():
|
|||
AND reviews.rating > 0
|
||||
AND addons.status IN (%s)
|
||||
GROUP BY addons_users.user_id
|
||||
""" % (",".join(map(str, VALID_STATUSES)))
|
||||
""" % (",".join(map(str, VALID_ADDON_STATUSES)))
|
||||
|
||||
cursor.execute(q)
|
||||
d = cursor.fetchall()
|
||||
|
|
|
@ -49,7 +49,7 @@ class VersionsRss(NonAtomicFeed):
|
|||
qs = Addon.objects
|
||||
self.addon = get_object_or_404(qs.id_or_slug(addon_id) & qs.valid())
|
||||
|
||||
status_list = (amo.STATUS_BETA,) if beta else amo.VALID_STATUSES
|
||||
status_list = (amo.STATUS_BETA,) if beta else amo.VALID_FILE_STATUSES
|
||||
items_qs = (self.addon.versions
|
||||
.filter(files__status__in=status_list)
|
||||
.distinct().order_by('-created'))
|
||||
|
|
|
@ -53,7 +53,7 @@ class XPIForm(happyforms.Form):
|
|||
a = Addon(guid=data['guid'],
|
||||
name=data['name'],
|
||||
type=data['type'],
|
||||
status=amo.STATUS_UNREVIEWED,
|
||||
status=amo.STATUS_NOMINATED,
|
||||
homepage=data['homepage'],
|
||||
summary=data['summary'])
|
||||
a.save()
|
||||
|
|
|
@ -50,7 +50,8 @@ class VersionManager(ManagerBase):
|
|||
return qs.transform(Version.transformer)
|
||||
|
||||
def valid(self):
|
||||
return self.filter(files__status__in=amo.VALID_STATUSES).distinct()
|
||||
return self.filter(
|
||||
files__status__in=amo.VALID_FILE_STATUSES).distinct()
|
||||
|
||||
|
||||
def source_upload_path(instance, filename):
|
||||
|
@ -433,22 +434,18 @@ class Version(OnChangeMixin, ModelBase):
|
|||
|
||||
@property
|
||||
def is_unreviewed(self):
|
||||
return filter(lambda f: f.status in amo.UNREVIEWED_STATUSES,
|
||||
return filter(lambda f: f.status in amo.UNREVIEWED_FILE_STATUSES,
|
||||
self.all_files)
|
||||
|
||||
@property
|
||||
def is_all_unreviewed(self):
|
||||
return not bool([f for f in self.all_files if f.status not in
|
||||
amo.UNREVIEWED_STATUSES])
|
||||
amo.UNREVIEWED_FILE_STATUSES])
|
||||
|
||||
@property
|
||||
def is_beta(self):
|
||||
return any(f for f in self.all_files if f.status == amo.STATUS_BETA)
|
||||
|
||||
@property
|
||||
def is_lite(self):
|
||||
return filter(lambda f: f.status in amo.LITE_STATUSES, self.all_files)
|
||||
|
||||
@property
|
||||
def is_jetpack(self):
|
||||
return all(f.jetpack_version for f in self.all_files)
|
||||
|
@ -515,7 +512,7 @@ class Version(OnChangeMixin, ModelBase):
|
|||
qs = File.objects.filter(version__addon=self.addon_id,
|
||||
version__lt=self.id,
|
||||
version__deleted=False,
|
||||
status__in=[amo.STATUS_UNREVIEWED,
|
||||
status__in=[amo.STATUS_AWAITING_REVIEW,
|
||||
amo.STATUS_PENDING])
|
||||
# Use File.update so signals are triggered.
|
||||
for f in qs:
|
||||
|
@ -535,17 +532,8 @@ class Version(OnChangeMixin, ModelBase):
|
|||
|
||||
@property
|
||||
def unreviewed_files(self):
|
||||
"""A File is unreviewed if:
|
||||
- its status is in amo.UNDER_REVIEW_STATUSES or
|
||||
- its addon status is in amo.UNDER_REVIEW_STATUSES
|
||||
and its status is either in amo.UNDER_REVIEW_STATUSES or
|
||||
amo.STATUS_LITE
|
||||
"""
|
||||
under_review_or_lite = amo.UNDER_REVIEW_STATUSES + (amo.STATUS_LITE,)
|
||||
return self.files.filter(
|
||||
models.Q(status__in=amo.UNDER_REVIEW_STATUSES) |
|
||||
models.Q(version__addon__status__in=amo.UNDER_REVIEW_STATUSES,
|
||||
status__in=under_review_or_lite))
|
||||
"""A File is unreviewed if its status is amo.STATUS_AWAITING_REVIEW."""
|
||||
return self.files.filter(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
|
||||
@Version.on_change
|
||||
|
|
|
@ -190,7 +190,7 @@ class TestVersion(TestCase):
|
|||
return v
|
||||
|
||||
def test_is_unreviewed(self):
|
||||
assert self._get_version(amo.STATUS_UNREVIEWED).is_unreviewed
|
||||
assert self._get_version(amo.STATUS_AWAITING_REVIEW).is_unreviewed
|
||||
assert self._get_version(amo.STATUS_PENDING).is_unreviewed
|
||||
assert not self._get_version(amo.STATUS_PUBLIC).is_unreviewed
|
||||
|
||||
|
@ -339,7 +339,7 @@ class TestVersion(TestCase):
|
|||
assert qs.all()[0].status == amo.STATUS_PUBLIC
|
||||
assert not hide_mock.called
|
||||
|
||||
qs.update(status=amo.STATUS_UNREVIEWED)
|
||||
qs.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
version = Version.objects.create(addon=addon)
|
||||
version.disable_old_files()
|
||||
assert qs.all()[0].status == amo.STATUS_DISABLED
|
||||
|
@ -349,12 +349,12 @@ class TestVersion(TestCase):
|
|||
def test_new_version_beta(self):
|
||||
addon = Addon.objects.get(id=3615)
|
||||
qs = File.objects.filter(version=addon.current_version)
|
||||
qs.update(status=amo.STATUS_UNREVIEWED)
|
||||
qs.update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
|
||||
version = Version.objects.create(addon=addon)
|
||||
File.objects.create(version=version, status=amo.STATUS_BETA)
|
||||
version.disable_old_files()
|
||||
assert qs.all()[0].status == amo.STATUS_UNREVIEWED
|
||||
assert qs.all()[0].status == amo.STATUS_AWAITING_REVIEW
|
||||
|
||||
def test_version_int(self):
|
||||
version = Version.objects.get(pk=81551)
|
||||
|
@ -561,37 +561,12 @@ class TestVersion(TestCase):
|
|||
|
||||
|
||||
@pytest.mark.parametrize("addon_status,file_status,is_unreviewed", [
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_LITE, True),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_LITE_AND_NOMINATED, True),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_NOMINATED, True),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_PUBLIC, False),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_DISABLED, False),
|
||||
(amo.STATUS_UNREVIEWED, amo.STATUS_BETA, False),
|
||||
(amo.STATUS_LITE, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_LITE, amo.STATUS_LITE, False),
|
||||
(amo.STATUS_LITE, amo.STATUS_LITE_AND_NOMINATED, True),
|
||||
(amo.STATUS_LITE, amo.STATUS_NOMINATED, True),
|
||||
(amo.STATUS_LITE, amo.STATUS_PUBLIC, False),
|
||||
(amo.STATUS_LITE, amo.STATUS_DISABLED, False),
|
||||
(amo.STATUS_LITE, amo.STATUS_BETA, False),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE, True),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_LITE_AND_NOMINATED, True),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_NOMINATED, True),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_PUBLIC, False),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_DISABLED, False),
|
||||
(amo.STATUS_LITE_AND_NOMINATED, amo.STATUS_BETA, False),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_LITE, True),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_LITE_AND_NOMINATED, True),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_AWAITING_REVIEW, True),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_NOMINATED, True),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_PUBLIC, False),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_DISABLED, False),
|
||||
(amo.STATUS_NOMINATED, amo.STATUS_BETA, False),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_UNREVIEWED, True),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_LITE, False),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_LITE_AND_NOMINATED, True),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_AWAITING_REVIEW, True),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_NOMINATED, True),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_PUBLIC, False),
|
||||
(amo.STATUS_PUBLIC, amo.STATUS_DISABLED, False),
|
||||
|
@ -884,7 +859,7 @@ class TestDownloads(TestDownloadsBase):
|
|||
self.assert_served_by_mirror(self.client.get(self.file_url))
|
||||
|
||||
def test_public_addon_unreviewed_file(self):
|
||||
self.file.status = amo.STATUS_UNREVIEWED
|
||||
self.file.status = amo.STATUS_AWAITING_REVIEW
|
||||
self.file.save()
|
||||
self.assert_served_locally(self.client.get(self.file_url))
|
||||
|
||||
|
@ -1407,7 +1382,7 @@ class TestStatusFromUpload(TestVersionFromUpload):
|
|||
self.current = self.addon.current_version
|
||||
|
||||
def test_status(self):
|
||||
self.current.files.all().update(status=amo.STATUS_UNREVIEWED)
|
||||
self.current.files.all().update(status=amo.STATUS_AWAITING_REVIEW)
|
||||
Version.from_upload(self.upload, self.addon, [self.platform])
|
||||
assert File.objects.filter(version=self.current)[0].status == (
|
||||
amo.STATUS_DISABLED)
|
||||
|
|
|
@ -31,7 +31,7 @@ log = commonware.log.getLogger('z.versions')
|
|||
@mobile_template('versions/{mobile/}version_list.html')
|
||||
@non_atomic_requests
|
||||
def version_list(request, addon, template, beta=False):
|
||||
status_list = (amo.STATUS_BETA,) if beta else amo.VALID_STATUSES
|
||||
status_list = (amo.STATUS_BETA,) if beta else amo.VALID_FILE_STATUSES
|
||||
qs = (addon.versions.filter(files__status__in=status_list)
|
||||
.distinct().order_by('-created'))
|
||||
versions = amo.utils.paginate(request, qs, PER_PAGE)
|
||||
|
@ -44,7 +44,7 @@ def version_list(request, addon, template, beta=False):
|
|||
@addon_view
|
||||
@non_atomic_requests
|
||||
def version_detail(request, addon, version_num):
|
||||
qs = (addon.versions.filter(files__status__in=amo.VALID_STATUSES)
|
||||
qs = (addon.versions.filter(files__status__in=amo.VALID_FILE_STATUSES)
|
||||
.distinct().order_by('-created'))
|
||||
|
||||
# Use cached_with since values_list won't be cached.
|
||||
|
@ -69,7 +69,7 @@ def _find_version_page(qs, addon, version_num):
|
|||
@non_atomic_requests
|
||||
def update_info(request, addon, version_num):
|
||||
qs = addon.versions.filter(version=version_num,
|
||||
files__status__in=amo.VALID_STATUSES)
|
||||
files__status__in=amo.VALID_FILE_STATUSES)
|
||||
if not qs:
|
||||
raise http.Http404()
|
||||
serve_xhtml = ('application/xhtml+xml' in
|
||||
|
|
|
@ -127,7 +127,7 @@ def add_validation_jobs(pks, job_pk, **kw):
|
|||
job = ValidationJob.objects.get(pk=job_pk)
|
||||
curr_ver = job.curr_max_version.version_int
|
||||
target_ver = job.target_version.version_int
|
||||
prelim_app = list(amo.UNDER_REVIEW_STATUSES) + [amo.STATUS_BETA]
|
||||
unreviewed_statuses = (amo.STATUS_AWAITING_REVIEW, amo.STATUS_BETA)
|
||||
for addon in Addon.objects.filter(pk__in=pks):
|
||||
ids = set()
|
||||
base = addon.versions.filter(apps__application=job.application,
|
||||
|
@ -152,26 +152,13 @@ def add_validation_jobs(pks, job_pk, **kw):
|
|||
|
||||
if public:
|
||||
ids.update([f.id for f in public.files.all()])
|
||||
ids.update(base.filter(files__status__in=prelim_app,
|
||||
ids.update(base.filter(files__status__in=unreviewed_statuses,
|
||||
id__gt=public.id)
|
||||
.values_list('files__id', flat=True))
|
||||
|
||||
else:
|
||||
try:
|
||||
prelim = (base.filter(files__status__in=amo.LITE_STATUSES)
|
||||
.latest('id'))
|
||||
except ObjectDoesNotExist:
|
||||
prelim = None
|
||||
|
||||
if prelim:
|
||||
ids.update([f.id for f in prelim.files.all()])
|
||||
ids.update(base.filter(files__status__in=prelim_app,
|
||||
id__gt=prelim.id)
|
||||
.values_list('files__id', flat=True))
|
||||
|
||||
else:
|
||||
ids.update(base.filter(files__status__in=prelim_app)
|
||||
.values_list('files__id', flat=True))
|
||||
ids.update(base.filter(files__status__in=unreviewed_statuses)
|
||||
.values_list('files__id', flat=True))
|
||||
|
||||
log.info('Adding %s files for validation for '
|
||||
'addon: %s for job: %s' % (len(ids), addon.pk, job_pk))
|
||||
|
@ -594,13 +581,11 @@ def fetch_langpack(url, xpi, **kw):
|
|||
.format(xpi, data['version']))
|
||||
|
||||
file_ = version.files.get()
|
||||
if is_beta:
|
||||
sign_file(file_, settings.PRELIMINARY_SIGNING_SERVER)
|
||||
else:
|
||||
if not is_beta:
|
||||
# Not `version.files.update`, because we need to trigger save
|
||||
# hooks.
|
||||
file_.update(status=amo.STATUS_PUBLIC)
|
||||
sign_file(file_, settings.SIGNING_SERVER)
|
||||
sign_file(file_, settings.SIGNING_SERVER)
|
||||
|
||||
addon.update_version()
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ class TestLangpackFetcher(TestCase):
|
|||
assert version.files.all()[0].status == amo.STATUS_BETA
|
||||
|
||||
mock_sign_file.assert_called_with(
|
||||
version.files.get(), settings.PRELIMINARY_SIGNING_SERVER)
|
||||
version.files.get(), settings.SIGNING_SERVER)
|
||||
|
||||
@mock.patch('olympia.zadmin.tasks.sign_file')
|
||||
def test_fetch_new_langpack_beta(self, mock_sign_file):
|
||||
|
|
|
@ -853,7 +853,7 @@ class TestBulkValidationTask(BulkValidationTest):
|
|||
assert old_version.files.all()[0].pk == ids[0]
|
||||
|
||||
def test_getting_latest_public_order(self):
|
||||
self.create_version(self.addon, [amo.STATUS_UNREVIEWED])
|
||||
self.create_version(self.addon, [amo.STATUS_AWAITING_REVIEW])
|
||||
new_version = self.create_version(self.addon, [amo.STATUS_PUBLIC])
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 1
|
||||
|
@ -875,41 +875,16 @@ class TestBulkValidationTask(BulkValidationTest):
|
|||
self.addon.update(status=amo.STATUS_PUBLIC)
|
||||
assert len(self.find_files()) == 0
|
||||
|
||||
def test_not_public(self):
|
||||
version = self.create_version(self.addon, [amo.STATUS_LITE])
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 1
|
||||
assert version.files.all()[0].pk == ids[0]
|
||||
|
||||
def test_not_public_and_newer(self):
|
||||
self.create_version(self.addon, [amo.STATUS_LITE])
|
||||
new_version = self.create_version(self.addon, [amo.STATUS_LITE])
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 1
|
||||
assert new_version.files.all()[0].pk == ids[0]
|
||||
|
||||
def test_not_public_w_beta(self):
|
||||
self.create_version(self.addon, [amo.STATUS_LITE])
|
||||
def test_beta(self):
|
||||
self.create_version(self.addon, [amo.STATUS_BETA])
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 2
|
||||
assert len(ids) == 1
|
||||
|
||||
def test_not_public_w_multiple_files(self):
|
||||
self.create_version(self.addon, [amo.STATUS_BETA])
|
||||
new_version = self.create_version(self.addon, [amo.STATUS_LITE,
|
||||
amo.STATUS_BETA])
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 2
|
||||
assert sorted([v.id for v in new_version.files.all()]) == sorted(ids)
|
||||
|
||||
def test_not_prelim_w_multiple_files(self):
|
||||
def test_w_multiple_files(self):
|
||||
self.create_version(self.addon, [amo.STATUS_BETA])
|
||||
self.create_version(self.addon, [amo.STATUS_BETA,
|
||||
amo.STATUS_NOMINATED])
|
||||
amo.STATUS_AWAITING_REVIEW])
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 3
|
||||
|
@ -924,7 +899,8 @@ class TestBulkValidationTask(BulkValidationTest):
|
|||
|
||||
def test_getting_w_unreviewed(self):
|
||||
old_version = self.create_version(self.addon, [amo.STATUS_PUBLIC])
|
||||
new_version = self.create_version(self.addon, [amo.STATUS_UNREVIEWED])
|
||||
new_version = self.create_version(self.addon,
|
||||
[amo.STATUS_AWAITING_REVIEW])
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 2
|
||||
old_version_pk = old_version.files.all()[0].pk
|
||||
|
@ -946,20 +922,20 @@ class TestBulkValidationTask(BulkValidationTest):
|
|||
|
||||
def test_multiple_addons(self):
|
||||
addon = Addon.objects.create(type=amo.ADDON_EXTENSION)
|
||||
self.create_version(addon, [amo.STATUS_UNREVIEWED])
|
||||
self.create_version(addon, [amo.STATUS_AWAITING_REVIEW])
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 1
|
||||
assert self.version.files.all()[0].pk == ids[0]
|
||||
|
||||
def test_no_app(self):
|
||||
version = self.create_version(self.addon, [amo.STATUS_LITE])
|
||||
version = self.create_version(self.addon, [amo.STATUS_PUBLIC])
|
||||
self.delete_orig_version()
|
||||
version.apps.all().delete()
|
||||
ids = self.find_files()
|
||||
assert len(ids) == 0
|
||||
|
||||
def test_wrong_version(self):
|
||||
self.create_version(self.addon, [amo.STATUS_LITE],
|
||||
self.create_version(self.addon, [amo.STATUS_PUBLIC],
|
||||
version_str='4.0b2pre')
|
||||
self.delete_orig_version()
|
||||
ids = self.find_files()
|
||||
|
|
|
@ -142,7 +142,7 @@ def find_files(job):
|
|||
current = job.curr_max_version.version_int
|
||||
target = job.target_version.version_int
|
||||
addons = (
|
||||
Addon.objects.filter(status__in=amo.VALID_STATUSES,
|
||||
Addon.objects.filter(status__in=amo.VALID_ADDON_STATUSES,
|
||||
disabled_by_user=False,
|
||||
versions__apps__application=job.application,
|
||||
versions__apps__max__version_int__gte=current,
|
||||
|
@ -451,10 +451,11 @@ def email_devs(request):
|
|||
preview_csv = None
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
data = form.cleaned_data
|
||||
qs = (AddonUser.objects.filter(role__in=(amo.AUTHOR_ROLE_DEV,
|
||||
amo.AUTHOR_ROLE_OWNER))
|
||||
.exclude(user__email=None)
|
||||
.filter(addon__status__in=amo.LISTED_STATUSES))
|
||||
qs = (
|
||||
AddonUser.objects.filter(
|
||||
role__in=(amo.AUTHOR_ROLE_DEV, amo.AUTHOR_ROLE_OWNER))
|
||||
.exclude(user__email=None)
|
||||
.filter(addon__status__in=amo.VALID_ADDON_STATUSES))
|
||||
|
||||
if data['recipients'] == 'eula':
|
||||
qs = qs.exclude(addon__eula=None)
|
||||
|
|
Загрузка…
Ссылка в новой задаче