fix admin override on upload feature (#20313)
This commit is contained in:
Родитель
80a559610d
Коммит
b27546a5be
|
@ -2249,6 +2249,24 @@ class VersionSubmitUploadMixin:
|
|||
else:
|
||||
assert version.previews.all().count() == 0
|
||||
|
||||
def test_admin_override(self):
|
||||
self.grant_permission(self.user, ':'.join(amo.permissions.REVIEWS_ADMIN))
|
||||
assert not AddonReviewerFlags.objects.filter(
|
||||
addon=self.addon, needs_admin_code_review=True
|
||||
).exists()
|
||||
response = self.post(override_validation=True)
|
||||
assert response.status_code == 302
|
||||
assert AddonReviewerFlags.objects.filter(
|
||||
addon=self.addon, needs_admin_code_review=True
|
||||
).exists()
|
||||
|
||||
def test_admin_override_no_permission(self):
|
||||
response = self.post(override_validation=True)
|
||||
assert response.status_code == 302
|
||||
assert not AddonReviewerFlags.objects.filter(
|
||||
addon=self.addon, needs_admin_code_review=True
|
||||
).exists()
|
||||
|
||||
|
||||
class TestVersionSubmitUploadListed(VersionSubmitUploadMixin, UploadMixin, TestCase):
|
||||
channel = amo.CHANNEL_LISTED
|
||||
|
|
|
@ -1218,8 +1218,12 @@ def version_reenable(request, addon_id, addon):
|
|||
|
||||
|
||||
def check_validation_override(request, form, addon, version):
|
||||
if version and form.cleaned_data.get('admin_override_validation'):
|
||||
helper = ReviewHelper(request=request, addon=addon, version=version)
|
||||
if (
|
||||
version
|
||||
and form.cleaned_data.get('admin_override_validation')
|
||||
and acl.action_allowed_for(request.user, amo.permissions.REVIEWS_ADMIN)
|
||||
):
|
||||
helper = ReviewHelper(addon=addon, version=version, user=request.user)
|
||||
helper.set_data(
|
||||
{
|
||||
'operating_systems': '',
|
||||
|
@ -1231,7 +1235,7 @@ def check_validation_override(request, form, addon, version):
|
|||
),
|
||||
}
|
||||
)
|
||||
helper.actions['super']['method']()
|
||||
helper.handler.process_super_review()
|
||||
|
||||
|
||||
@dev_required
|
||||
|
|
Загрузка…
Ссылка в новой задаче