зеркало из https://github.com/mozilla/normandy.git
Update dependencies within semver
This commit is contained in:
Родитель
990c72e77d
Коммит
f83ab5956c
|
@ -145,7 +145,7 @@ class RecipeViewSet(CachingViewsetMixin, viewsets.ReadOnlyModelViewSet):
|
|||
def history(self, request, pk=None):
|
||||
recipe = self.get_object()
|
||||
serializer = RecipeRevisionSerializer(
|
||||
recipe.revisions.all(), many=True, context={"request": request}
|
||||
recipe.revisions.all().order_by("-id"), many=True, context={"request": request}
|
||||
)
|
||||
return Response(serializer.data)
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class RecipeViewSet(CachingViewsetMixin, UpdateOrCreateModelViewSet):
|
|||
def history(self, request, pk=None):
|
||||
recipe = self.get_object()
|
||||
serializer = RecipeRevisionSerializer(
|
||||
recipe.revisions.all(), many=True, context={"request": request}
|
||||
recipe.revisions.all().order_by("-id"), many=True, context={"request": request}
|
||||
)
|
||||
return Response(serializer.data)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ from django.utils import timezone
|
|||
|
||||
import factory
|
||||
from factory.django import DjangoModelFactory
|
||||
from faker import Faker
|
||||
|
||||
from normandy.base.tests import FuzzyUnicode, UserFactory, FuzzySlug
|
||||
from normandy.base.utils import sri_hash
|
||||
|
@ -263,9 +264,7 @@ class PreferenceRolloutArgumentsFactory(DictFactory):
|
|||
class OptOutStudyArgumentsFactory(DictFactory):
|
||||
name = factory.fuzzy.FuzzyText()
|
||||
description = factory.faker.Faker("paragraph")
|
||||
addonUrl = factory.lazy_attribute(
|
||||
lambda x: f"https://example.com/{x}" + factory.faker.Faker("file_path").generate()
|
||||
)
|
||||
addonUrl = factory.lazy_attribute(lambda x: f"https://example.com/{x}" + Faker().file_path())
|
||||
extensionApiId = factory.fuzzy.FuzzyInteger(1, 1000)
|
||||
|
||||
|
||||
|
|
|
@ -73,9 +73,11 @@ class Extension(DirtyFieldsMixin, models.Model):
|
|||
with zf.open("install.rdf", "r") as rdf_file:
|
||||
try:
|
||||
data = untangle.parse(rdf_file.read().decode())
|
||||
except SAXParseException:
|
||||
except SAXParseException as e:
|
||||
raise ValidationError(
|
||||
{"xpi": 'Legacy addon "install.rdf" is corrupt.'}
|
||||
{
|
||||
"xpi": f'Legacy addon "install.rdf" is corrupt: {e.getMessage()}.'
|
||||
}
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
|
@ -3,6 +3,7 @@ import json
|
|||
import tempfile
|
||||
import zipfile
|
||||
from factory.django import DjangoModelFactory
|
||||
from faker import Faker
|
||||
|
||||
from normandy.base.tests import FuzzyUnicode
|
||||
from normandy.studies.models import Extension
|
||||
|
@ -61,7 +62,7 @@ class WebExtensionFileFactory(XPIFileFactory):
|
|||
super().__init__(signed=signed)
|
||||
|
||||
if not gecko_id:
|
||||
gecko_id = f"{factory.Faker('md5').generate({})}@normandy.mozilla.org"
|
||||
gecko_id = f"{Faker().md5()}@normandy.mozilla.org"
|
||||
|
||||
if from_file:
|
||||
self._manifest = json.load(from_file)
|
||||
|
@ -100,7 +101,8 @@ class LegacyAddonFileFactory(XPIFileFactory):
|
|||
super().__init__(signed=signed)
|
||||
|
||||
if not addon_id:
|
||||
addon_id = f"{factory.Faker('md5').generate({})}@normandy.mozilla.org"
|
||||
name = Faker().md5()
|
||||
addon_id = f"{name}@normandy.mozilla.org"
|
||||
|
||||
if from_file:
|
||||
with open(from_file, "rb") as f:
|
||||
|
|
|
@ -134,7 +134,9 @@ class TestExtension(object):
|
|||
with pytest.raises(ValidationError) as exc:
|
||||
ExtensionFactory(xpi__from_func=xpi.open)
|
||||
assert len(exc.value.error_dict["xpi"]) == 1
|
||||
assert exc.value.error_dict["xpi"][0].message == 'Legacy addon "install.rdf" is corrupt.'
|
||||
assert exc.value.error_dict["xpi"][0].message.startswith(
|
||||
'Legacy addon "install.rdf" is corrupt:'
|
||||
)
|
||||
|
||||
@pytest.mark.django_db()
|
||||
def test_legacy_no_id(self):
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче