drop is_restart_required from File (and api/v5) (#17675)
This commit is contained in:
Родитель
c7ddc38f3b
Коммит
c91deaaf70
|
@ -384,7 +384,6 @@ This endpoint allows you to fetch a single version belonging to a specific add-o
|
|||
:>json string files[].created: The creation date for a file.
|
||||
:>json string files[].hash: The hash for a file.
|
||||
:>json boolean files[].is_mozilla_signed_extension: Whether the file was signed with a Mozilla internal certificate or not.
|
||||
:>json boolean files[].is_restart_required: Whether the file requires a browser restart to work once installed or not.
|
||||
:>json boolean files[].is_webextension: Whether the file is a WebExtension or not.
|
||||
:>json array files[].optional_permissions[]: Array of the optional webextension permissions for this File, as strings. Empty for non-webextensions.
|
||||
:>json array files[].permissions[]: Array of the webextension permissions for this File, as strings. Empty for non-webextensions.
|
||||
|
|
|
@ -424,6 +424,7 @@ These are `v5` specific changes - `v4` changes apply also.
|
|||
* 2021-07-29: updated docs shelves footer url to be non-optional. https://github.com/mozilla/addons-server/issues/17544
|
||||
* 2021-08-05: added ``ratings`` and ``users`` query parameters to addon search api. https://github.com/mozilla/addons-server/issues/17497
|
||||
* 2021-08-05: removed ``criteria`` from shelves endpoint. https://github.com/mozilla/addons-server/issues/17498
|
||||
* 2021-08-12: removed ``is_restart_required`` from addons endpoints. https://github.com/mozilla/addons-server/issues/17390
|
||||
|
||||
|
||||
.. _`#11380`: https://github.com/mozilla/addons-server/issues/11380/
|
||||
|
|
|
@ -396,7 +396,6 @@
|
|||
"version": 1,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:39:45",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
@ -415,7 +414,6 @@
|
|||
"version": 2,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:40:07",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
@ -434,7 +432,6 @@
|
|||
"version": 3,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:40:16",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
@ -453,7 +450,6 @@
|
|||
"version": 4,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:40:23",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
@ -472,7 +468,6 @@
|
|||
"version": 5,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:40:24",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
@ -491,7 +486,6 @@
|
|||
"version": 6,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2014-12-08T06:40:25",
|
||||
"is_restart_required": true,
|
||||
"size": 0
|
||||
}
|
||||
},
|
||||
|
|
|
@ -267,7 +267,6 @@
|
|||
"version": 1268881,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2011-12-05 14:46:43",
|
||||
"is_restart_required": true,
|
||||
"binary": false,
|
||||
"binary_components": false,
|
||||
"size": 0
|
||||
|
@ -286,7 +285,6 @@
|
|||
"version": 1268882,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2011-12-05 14:46:43",
|
||||
"is_restart_required": true,
|
||||
"binary": false,
|
||||
"binary_components": false,
|
||||
"size": 0
|
||||
|
@ -305,7 +303,6 @@
|
|||
"version": 1268883,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2011-12-05 14:46:43",
|
||||
"is_restart_required": true,
|
||||
"binary": false,
|
||||
"binary_components": false,
|
||||
"size": 0
|
||||
|
@ -324,7 +321,6 @@
|
|||
"version": 1268884,
|
||||
"reviewed": null,
|
||||
"datestatuschanged": "2011-12-05 14:46:43",
|
||||
"is_restart_required": true,
|
||||
"binary": false,
|
||||
"binary_components": false,
|
||||
"size": 0
|
||||
|
|
|
@ -246,7 +246,6 @@ class AddonIndexer(BaseSearchIndexer):
|
|||
'filename': {'type': 'keyword', 'index': False},
|
||||
'is_webextension': {'type': 'boolean'},
|
||||
'is_mozilla_signed_extension': {'type': 'boolean'},
|
||||
'is_restart_required': {'type': 'boolean', 'index': False},
|
||||
'size': {'type': 'long', 'index': False},
|
||||
'strict_compatibility': {'type': 'boolean', 'index': False},
|
||||
'status': {'type': 'byte'},
|
||||
|
@ -407,7 +406,6 @@ class AddonIndexer(BaseSearchIndexer):
|
|||
'is_mozilla_signed_extension': (
|
||||
file_.is_mozilla_signed_extension
|
||||
),
|
||||
'is_restart_required': file_.is_restart_required,
|
||||
'size': file_.size,
|
||||
'status': file_.status,
|
||||
'strict_compatibility': file_.strict_compatibility,
|
||||
|
|
|
@ -1437,12 +1437,6 @@ class Addon(OnChangeMixin, ModelBase):
|
|||
manager = self.versions
|
||||
return manager.filter(channel=amo.RELEASE_CHANNEL_UNLISTED).exists()
|
||||
|
||||
@property
|
||||
def is_restart_required(self):
|
||||
"""Whether the add-on current version requires a browser restart to
|
||||
work."""
|
||||
return self.current_version and self.current_version.is_restart_required
|
||||
|
||||
def _is_recommended_theme(self):
|
||||
from olympia.bandwagon.models import CollectionAddon
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class FileSerializer(serializers.ModelSerializer):
|
|||
status = ReverseChoiceField(choices=list(amo.STATUS_CHOICES_API.items()))
|
||||
permissions = serializers.ListField(child=serializers.CharField())
|
||||
optional_permissions = serializers.ListField(child=serializers.CharField())
|
||||
is_restart_required = serializers.BooleanField()
|
||||
is_restart_required = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = File
|
||||
|
@ -76,6 +76,8 @@ class FileSerializer(serializers.ModelSerializer):
|
|||
request = self.context.get('request', None)
|
||||
if request and not is_gate_active(request, 'platform-shim'):
|
||||
data.pop('platform', None)
|
||||
if request and not is_gate_active(request, 'is-restart-required-shim'):
|
||||
data.pop('is_restart_required', None)
|
||||
return data
|
||||
|
||||
def get_platform(self, obj):
|
||||
|
@ -83,6 +85,11 @@ class FileSerializer(serializers.ModelSerializer):
|
|||
# fake it by just returning 'all' all the time.
|
||||
return 'all'
|
||||
|
||||
def get_is_restart_required(self, obj):
|
||||
# is_restart_required is gone from the model and all addons are restartless now
|
||||
# so fake it for older API clients with False
|
||||
return False
|
||||
|
||||
|
||||
class PreviewSerializer(serializers.ModelSerializer):
|
||||
caption = TranslationSerializerField()
|
||||
|
@ -638,7 +645,6 @@ class ESAddonSerializer(BaseESSerializer, AddonSerializer):
|
|||
filename=data['filename'],
|
||||
is_webextension=data.get('is_webextension'),
|
||||
is_mozilla_signed_extension=data.get('is_mozilla_signed_extension'),
|
||||
is_restart_required=data.get('is_restart_required', False),
|
||||
size=data['size'],
|
||||
status=data['status'],
|
||||
strict_compatibility=data.get('strict_compatibility', False),
|
||||
|
|
|
@ -168,7 +168,6 @@ class TestAddonIndexer(TestCase):
|
|||
'filename',
|
||||
'hash',
|
||||
'is_webextension',
|
||||
'is_restart_required',
|
||||
'is_mozilla_signed_extension',
|
||||
'size',
|
||||
'status',
|
||||
|
@ -330,7 +329,6 @@ class TestAddonIndexer(TestCase):
|
|||
assert extracted_file['filename'] == file_.filename
|
||||
assert extracted_file['hash'] == file_.hash
|
||||
assert extracted_file['is_webextension'] == file_.is_webextension
|
||||
assert extracted_file['is_restart_required'] == (file_.is_restart_required)
|
||||
assert extracted_file['is_mozilla_signed_extension'] == (
|
||||
file_.is_mozilla_signed_extension
|
||||
)
|
||||
|
|
|
@ -845,19 +845,6 @@ class TestAddonModels(TestCase):
|
|||
addon.disabled_by_user = True
|
||||
assert not addon.is_public()
|
||||
|
||||
def test_is_restart_required(self):
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
file_ = addon.current_version.all_files[0]
|
||||
assert not file_.is_restart_required
|
||||
assert not addon.is_restart_required
|
||||
|
||||
file_.update(is_restart_required=True)
|
||||
assert Addon.objects.get(pk=3615).is_restart_required
|
||||
|
||||
addon.versions.all().delete()
|
||||
addon._current_version = None
|
||||
assert not addon.is_restart_required
|
||||
|
||||
def newlines_helper(self, string_before):
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
addon.privacy_policy = string_before
|
||||
|
|
|
@ -116,7 +116,6 @@ class AddonSerializerOutputTestMixin:
|
|||
file_.created.replace(microsecond=0).isoformat() + 'Z'
|
||||
)
|
||||
assert result_file['hash'] == file_.hash
|
||||
assert result_file['is_restart_required'] == file_.is_restart_required
|
||||
assert result_file['is_webextension'] == file_.is_webextension
|
||||
assert (
|
||||
result_file['is_mozilla_signed_extension']
|
||||
|
@ -156,7 +155,6 @@ class AddonSerializerOutputTestMixin:
|
|||
developer_comments='Dévelopers Addôn comments',
|
||||
file_kw={
|
||||
'hash': 'fakehash',
|
||||
'is_restart_required': False,
|
||||
'is_webextension': True,
|
||||
'size': 42,
|
||||
},
|
||||
|
@ -651,10 +649,17 @@ class AddonSerializerOutputTestMixin:
|
|||
)
|
||||
|
||||
def test_is_restart_required(self):
|
||||
self.addon = addon_factory(file_kw={'is_restart_required': True})
|
||||
self.addon = addon_factory()
|
||||
result = self.serialize()
|
||||
file_data = result['current_version']['files'][0]
|
||||
assert 'is_restart_required' not in file_data
|
||||
|
||||
self._test_version(self.addon.current_version, result['current_version'])
|
||||
# Test with shim
|
||||
gates = {self.request.version: ('is-restart-required-shim',)}
|
||||
with override_settings(DRF_API_GATES=gates):
|
||||
result = self.serialize()
|
||||
file_data = result['current_version']['files'][0]
|
||||
assert file_data['is_restart_required'] is False
|
||||
|
||||
def test_special_compatibility_cases(self):
|
||||
# Test an add-on with strict compatibility enabled.
|
||||
|
|
|
@ -144,7 +144,6 @@
|
|||
"model": "files.file",
|
||||
"fields": {
|
||||
"status": 1,
|
||||
"is_restart_required": true,
|
||||
"hash": "sha256:a300e3943309aee1e1ee47f569f9be36276791b3e66596be4c9cc4ee238b01b6",
|
||||
"created": "2010-12-17 13:04:57",
|
||||
"modified": "2010-12-17 13:04:57",
|
||||
|
@ -159,7 +158,6 @@
|
|||
"model": "files.file",
|
||||
"fields": {
|
||||
"status": 1,
|
||||
"is_restart_required": true,
|
||||
"hash": "sha256:a300e3943309aee1e1ee47f569f9be36276791b3e66596be4c9cc4ee238b01b6",
|
||||
"created": "2010-12-17 13:04:57",
|
||||
"modified": "2010-12-17 13:04:57",
|
||||
|
|
|
@ -34,7 +34,6 @@ class DiscoveryTestMixin:
|
|||
file_.created.replace(microsecond=0).isoformat() + 'Z'
|
||||
)
|
||||
assert result_file['hash'] == file_.hash
|
||||
assert result_file['is_restart_required'] == file_.is_restart_required
|
||||
assert result_file['is_webextension'] == file_.is_webextension
|
||||
assert (
|
||||
result_file['is_mozilla_signed_extension']
|
||||
|
|
|
@ -51,7 +51,6 @@ class FileAdmin(admin.ModelAdmin):
|
|||
'Flags',
|
||||
{
|
||||
'fields': (
|
||||
'is_restart_required',
|
||||
'strict_compatibility',
|
||||
'binary',
|
||||
'binary_components',
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.4 on 2021-08-06 18:30
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('files', '0011_file_manifest_version'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='file',
|
||||
name='is_restart_required',
|
||||
field=models.BooleanField(default=False, null=True),
|
||||
),
|
||||
]
|
|
@ -55,7 +55,6 @@ class File(OnChangeMixin, ModelBase):
|
|||
choices=STATUS_CHOICES.items(), default=amo.STATUS_AWAITING_REVIEW
|
||||
)
|
||||
datestatuschanged = models.DateTimeField(null=True, auto_now_add=True)
|
||||
is_restart_required = models.BooleanField(default=False)
|
||||
strict_compatibility = models.BooleanField(default=False)
|
||||
reviewed = models.DateTimeField(null=True, blank=True)
|
||||
# The `binary` field is used to store the flags from amo-validator when it
|
||||
|
@ -151,7 +150,6 @@ class File(OnChangeMixin, ModelBase):
|
|||
file_.filename = file_.generate_filename(extension=ext or '.xpi')
|
||||
# Size in bytes.
|
||||
file_.size = storage.size(upload_path)
|
||||
file_.is_restart_required = parsed_data.get('is_restart_required', False)
|
||||
file_.strict_compatibility = parsed_data.get('strict_compatibility', False)
|
||||
file_.is_experiment = parsed_data.get('is_experiment', False)
|
||||
file_.is_webextension = parsed_data.get('is_webextension', False)
|
||||
|
|
|
@ -631,13 +631,11 @@ class TestParseXpi(TestCase):
|
|||
# See #3315: webextension experiments (type 256) map to extensions.
|
||||
assert parsed['type'] == amo.ADDON_EXTENSION
|
||||
assert parsed['is_experiment']
|
||||
assert not parsed['is_restart_required']
|
||||
|
||||
def test_match_type_extension_for_webextensions(self):
|
||||
parsed = self.parse(filename='webextension.xpi')
|
||||
assert parsed['type'] == amo.ADDON_EXTENSION
|
||||
assert parsed['is_webextension']
|
||||
assert not parsed['is_restart_required']
|
||||
assert not parsed['is_experiment']
|
||||
|
||||
def test_experiment_inside_webextension(self):
|
||||
|
@ -645,7 +643,6 @@ class TestParseXpi(TestCase):
|
|||
parsed = self.parse(filename='experiment_inside_webextension.xpi')
|
||||
assert parsed['type'] == amo.ADDON_EXTENSION
|
||||
assert parsed['is_webextension']
|
||||
assert not parsed['is_restart_required']
|
||||
assert parsed['is_experiment']
|
||||
|
||||
def test_theme_experiment_inside_webextension(self):
|
||||
|
@ -653,7 +650,6 @@ class TestParseXpi(TestCase):
|
|||
parsed = self.parse(filename='theme_experiment_inside_webextension.xpi')
|
||||
assert parsed['type'] == amo.ADDON_STATICTHEME
|
||||
assert parsed['is_webextension']
|
||||
assert not parsed['is_restart_required']
|
||||
assert parsed['is_experiment']
|
||||
|
||||
def test_match_mozilla_signed_extension(self):
|
||||
|
@ -676,7 +672,6 @@ class TestParseXpi(TestCase):
|
|||
self.grant_permission(self.user, 'LanguagePack:Submit')
|
||||
result = self.parse(filename='webextension_langpack.xpi')
|
||||
assert result['type'] == amo.ADDON_LPAPP
|
||||
assert not result['is_restart_required']
|
||||
assert result['strict_compatibility']
|
||||
|
||||
def test_good_version_number(self):
|
||||
|
@ -1169,12 +1164,6 @@ class TestFileFromUpload(UploadTest):
|
|||
assert file_.hash.startswith('sha256:')
|
||||
assert len(file_.hash) == 64 + 7 # 64 for hash, 7 for 'sha256:'
|
||||
|
||||
def test_does_not_require_a_restart(self):
|
||||
upload = self.upload('webextension.xpi')
|
||||
parsed_data = parse_addon(upload.path, addon=self.addon, user=user_factory())
|
||||
file_ = File.from_upload(upload, self.version, parsed_data=parsed_data)
|
||||
assert not file_.is_restart_required
|
||||
|
||||
def test_utf8(self):
|
||||
upload = self.upload('wébextension.xpi')
|
||||
self.version.addon.name = 'jéts!'
|
||||
|
@ -1223,7 +1212,6 @@ class TestFileFromUpload(UploadTest):
|
|||
upload = self.upload('webextension_langpack.xpi')
|
||||
file_ = File.from_upload(upload, self.version, parsed_data={})
|
||||
assert file_.filename.endswith('.xpi')
|
||||
assert not file_.is_restart_required
|
||||
|
||||
def test_experiment(self):
|
||||
upload = self.upload('experiment_inside_webextension')
|
||||
|
|
|
@ -132,10 +132,6 @@ class TestManifestJSONExtractor(AppVersionsMixin, TestCase):
|
|||
"""manifest.json addons are always ADDON_EXTENSION."""
|
||||
assert self.parse({})['type'] == amo.ADDON_EXTENSION
|
||||
|
||||
def test_is_restart_required(self):
|
||||
"""manifest.json addons never requires restart."""
|
||||
assert self.parse({})['is_restart_required'] is False
|
||||
|
||||
def test_name(self):
|
||||
"""Use name for the name."""
|
||||
assert self.parse({'name': 'addon-name'})['name'] == 'addon-name'
|
||||
|
|
|
@ -402,7 +402,6 @@ class ManifestJSONExtractor:
|
|||
if not minimal:
|
||||
data.update(
|
||||
{
|
||||
'is_restart_required': False,
|
||||
'apps': list(self.apps()),
|
||||
# Langpacks have strict compatibility enabled, rest of
|
||||
# webextensions don't.
|
||||
|
|
|
@ -1600,6 +1600,7 @@ DRF_API_GATES = {
|
|||
'wrap-outgoing-parameter',
|
||||
'platform-shim',
|
||||
'keep-license-text-in-version-list',
|
||||
'is-restart-required-shim',
|
||||
),
|
||||
'v4': (
|
||||
'l10n_flat_input_output',
|
||||
|
@ -1609,6 +1610,7 @@ DRF_API_GATES = {
|
|||
'wrap-outgoing-parameter',
|
||||
'platform-shim',
|
||||
'keep-license-text-in-version-list',
|
||||
'is-restart-required-shim',
|
||||
),
|
||||
'v5': (
|
||||
'addons-search-_score-field',
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
"model": "files.file",
|
||||
"fields": {
|
||||
"status": 1,
|
||||
"is_restart_required": true,
|
||||
"hash": "sha256:1a496e35dd56fb377bb3dea306e285f0a3ff3e684fb758aaa04018e86da2ffaa",
|
||||
"created": "2010-08-27 21:15:32",
|
||||
"modified": "2010-08-27 21:15:32",
|
||||
|
|
|
@ -56,7 +56,6 @@ VIEW_QUEUE_FLAGS = (
|
|||
'needs-admin-theme-review',
|
||||
_('Needs Admin Static Theme Review'),
|
||||
),
|
||||
('is_restart_required', 'is_restart_required', _('Requires Restart')),
|
||||
('sources_provided', 'sources-provided', _('Sources provided')),
|
||||
('is_webextension', 'webextension', _('WebExtension')),
|
||||
(
|
||||
|
@ -148,7 +147,6 @@ class ViewQueue(RawSQLModel):
|
|||
addon_type_id = models.IntegerField()
|
||||
auto_approval_delayed_temporarily = models.BooleanField(null=True)
|
||||
auto_approval_delayed_indefinitely = models.BooleanField(null=True)
|
||||
is_restart_required = models.BooleanField()
|
||||
is_webextension = models.BooleanField()
|
||||
latest_version = models.CharField(max_length=255)
|
||||
needs_admin_code_review = models.BooleanField(null=True)
|
||||
|
@ -189,7 +187,6 @@ class ViewQueue(RawSQLModel):
|
|||
'auto_approval_delayed_until) = 9999'
|
||||
),
|
||||
),
|
||||
('is_restart_required', 'MAX(files.is_restart_required)'),
|
||||
('is_webextension', 'MAX(files.is_webextension)'),
|
||||
('latest_version', 'versions.version'),
|
||||
(
|
||||
|
|
|
@ -20,12 +20,6 @@
|
|||
|
||||
<div class="addon-info object-lead">
|
||||
<p{{ addon.summary|locale_html }}>{{ addon.summary|nl2br }}</p>
|
||||
{% if version and version.is_restart_required %}
|
||||
<div>
|
||||
<span>{{ _('Requires Restart') }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<table itemscope itemtype="http://data-vocabulary.org/Review-aggregate">
|
||||
{% with addon_name='<span itemprop="itemreviewed">{0}</span>'|format_html(addon.name) %}
|
||||
{# L10n: This is a caption for a table. {0} is an add-on name. #}
|
||||
|
|
|
@ -116,10 +116,7 @@ class TestExtensionQueueWithAwaitingReview(TestQueue):
|
|||
addon=addon,
|
||||
version=version,
|
||||
channel=self.channel,
|
||||
file_kw={
|
||||
'status': amo.STATUS_AWAITING_REVIEW,
|
||||
'is_restart_required': False,
|
||||
},
|
||||
file_kw={'status': amo.STATUS_AWAITING_REVIEW},
|
||||
)
|
||||
return addon
|
||||
|
||||
|
@ -168,14 +165,6 @@ class TestExtensionQueueWithAwaitingReview(TestQueue):
|
|||
queue = self.Queue.objects.get()
|
||||
assert queue.flags == [('needs-admin-code-review', 'Needs Admin Code Review')]
|
||||
|
||||
def test_flags_is_restart_required(self):
|
||||
self.new_addon().find_latest_version(self.channel).all_files[0].update(
|
||||
is_restart_required=True
|
||||
)
|
||||
|
||||
queue = self.Queue.objects.get()
|
||||
assert queue.flags == [('is_restart_required', 'Requires Restart')]
|
||||
|
||||
def test_flags_promoted(self):
|
||||
addon = self.new_addon()
|
||||
assert self.Queue.objects.get().flags == []
|
||||
|
|
|
@ -1369,41 +1369,6 @@ class TestQueueBasics(QueueTest):
|
|||
assert response.status_code == 200
|
||||
assert pq(response.content)('th.ordered a').text() == text
|
||||
|
||||
def test_flags_is_restart_required(self):
|
||||
addon = addon_factory(
|
||||
status=amo.STATUS_NOMINATED,
|
||||
name='Some Add-on',
|
||||
version_kw={'version': '0.1'},
|
||||
file_kw={'status': amo.STATUS_AWAITING_REVIEW, 'is_restart_required': True},
|
||||
)
|
||||
|
||||
r = self.client.get(reverse('reviewers.queue_extension'))
|
||||
|
||||
rows = pq(r.content)('#addon-queue tr.addon-row')
|
||||
assert rows.length == 1
|
||||
assert rows.attr('data-addon') == str(addon.id)
|
||||
assert rows.find('td').eq(1).text() == 'Some Add-on 0.1'
|
||||
assert rows.find('.ed-sprite-is_restart_required').length == 1
|
||||
|
||||
def test_flags_is_restart_required_false(self):
|
||||
addon = addon_factory(
|
||||
status=amo.STATUS_NOMINATED,
|
||||
name='Restartless',
|
||||
version_kw={'version': '0.1'},
|
||||
file_kw={
|
||||
'status': amo.STATUS_AWAITING_REVIEW,
|
||||
'is_restart_required': False,
|
||||
},
|
||||
)
|
||||
|
||||
r = self.client.get(reverse('reviewers.queue_extension'))
|
||||
|
||||
rows = pq(r.content)('#addon-queue tr.addon-row')
|
||||
assert rows.length == 1
|
||||
assert rows.attr('data-addon') == str(addon.id)
|
||||
assert rows.find('td').eq(1).text() == 'Restartless 0.1'
|
||||
assert rows.find('.ed-sprite-is_restart_required').length == 0
|
||||
|
||||
def test_flags_promoted(self):
|
||||
addon = addon_factory(name='Firefox Fún')
|
||||
version_factory(
|
||||
|
@ -3505,13 +3470,11 @@ class TestReview(ReviewBase):
|
|||
assert not doc('.is_promoted')
|
||||
|
||||
def test_not_flags(self):
|
||||
self.addon.current_version.files.update(is_restart_required=False)
|
||||
response = self.client.get(self.url)
|
||||
assert response.status_code == 200
|
||||
assert len(response.context['flags']) == 0
|
||||
|
||||
def test_flag_needs_admin_code_review(self):
|
||||
self.addon.current_version.files.update(is_restart_required=False)
|
||||
AddonReviewerFlags.objects.create(
|
||||
addon=self.addon, needs_admin_code_review=True
|
||||
)
|
||||
|
|
|
@ -578,10 +578,6 @@ class Version(OnChangeMixin, ModelBase):
|
|||
except ObjectDoesNotExist:
|
||||
return False
|
||||
|
||||
@property
|
||||
def is_restart_required(self):
|
||||
return any(file_.is_restart_required for file_ in self.all_files)
|
||||
|
||||
@property
|
||||
def is_webextension(self):
|
||||
return any(file_.is_webextension for file_ in self.all_files)
|
||||
|
|
|
@ -255,16 +255,6 @@ class TestVersion(TestCase):
|
|||
# ApplicationsVersions loaded from <Version>._compat_map().
|
||||
assert id(version) == id(version.compatible_apps[amo.FIREFOX].version)
|
||||
|
||||
def test_is_restart_required(self):
|
||||
version = Version.objects.get(pk=81551)
|
||||
file_ = version.all_files[0]
|
||||
assert not file_.is_restart_required
|
||||
assert not version.is_restart_required
|
||||
|
||||
file_.update(is_restart_required=True)
|
||||
version = Version.objects.get(pk=81551)
|
||||
assert version.is_restart_required
|
||||
|
||||
def test_is_webextension(self):
|
||||
version = Version.objects.get(pk=81551)
|
||||
file_ = version.all_files[0]
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
.ed-sprite-seamonkey { background-position: 0 -32px; }
|
||||
.ed-sprite-android { background-position: 0 -48px; }
|
||||
.ed-sprite-mobile { background-position: 0 -64px; }
|
||||
.ed-sprite-is_restart_required { background-position: 0 -96px; }
|
||||
.ed-sprite-notes { background-position: 0 -112px; }
|
||||
.ed-sprite-needs-admin-content-review { background-position: 0 -128px; }
|
||||
.ed-sprite-needs-admin-code-review { background-position: 0 -128px; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче