Skip to content

Commit

Permalink
Merge #2281
Browse files Browse the repository at this point in the history
2281: Dependencies 2020-10-28 r=mythmon a=mythmon

- Switch from drf-yasg to drf-yasg2 for better compatibility
- Update dependency djangorestframework to 3.12.*
- Update dependency factory_boy to v3


Co-authored-by: Mike Cooper <mythmon@gmail.com>
Co-authored-by: Renovate Bot <bot@renovateapp.com>
  • Loading branch information
3 people authored Oct 29, 2020
2 parents 7cfa0b5 + ed7f219 commit c7a3d01
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 50 deletions.
4 changes: 2 additions & 2 deletions normandy/base/api/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def get_urls(self):

return urls

def register(self, prefix, viewset, base_name=None, allow_cdn=True):
def register(self, prefix, viewset, basename=None, allow_cdn=True):
if not allow_cdn:
raise NotImplementedError("Can't pass allow_cdn=False for viewsets")
super().register(prefix, viewset, base_name=base_name)
super().register(prefix, viewset, basename=basename)

def register_view(self, prefix, View, *, name, allow_cdn=True, **kwargs):
url_pattern = url(r"^{}/$".format(prefix), View.as_view(), name=name, **kwargs)
Expand Down
4 changes: 2 additions & 2 deletions normandy/base/api/swagger_urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.conf.urls import url

from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from drf_yasg2.views import get_schema_view
from drf_yasg2 import openapi
from rest_framework import permissions


Expand Down
5 changes: 2 additions & 3 deletions normandy/base/api/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import re

from django.contrib.admindocs.views import simplify_regex

from rest_framework.compat import URLPattern, URLResolver, get_original_route
from django.urls import URLPattern, URLResolver


_PATH_PARAMETER_COMPONENT_RE = re.compile(r"<(?:(?P<converter>[^>:]+):)?(?P<parameter>\w+)>")
Expand Down Expand Up @@ -72,7 +71,7 @@ def get_api_endpoints(patterns=None, namespace="", prefix=""):
api_endpoints = []

for pattern in patterns:
path_regex = prefix + get_original_route(pattern)
path_regex = prefix + str(pattern.pattern)

if isinstance(pattern, URLPattern):
path = get_path_from_regex(path_regex)
Expand Down
3 changes: 2 additions & 1 deletion normandy/base/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

from django.contrib.auth.models import Group, User

from factory import DjangoModelFactory, fuzzy, Sequence
from factory import fuzzy, Sequence
from factory.django import DjangoModelFactory
import pytest


Expand Down
21 changes: 11 additions & 10 deletions normandy/recipes/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.utils import timezone

import factory
from factory.django import DjangoModelFactory

from normandy.base.tests import FuzzyUnicode, UserFactory, FuzzySlug
from normandy.base.utils import sri_hash
Expand All @@ -24,7 +25,7 @@
)


class ChannelFactory(factory.DjangoModelFactory):
class ChannelFactory(DjangoModelFactory):
class Meta:
model = Channel
django_get_or_create = ("slug",)
Expand All @@ -33,7 +34,7 @@ class Meta:
name = "Beta"


class WindowsVersionFactory(factory.DjangoModelFactory):
class WindowsVersionFactory(DjangoModelFactory):
class Meta:
model = WindowsVersion
django_get_or_create = ("nt_version",)
Expand All @@ -42,7 +43,7 @@ class Meta:
name = "Windows 7"


class CountryFactory(factory.DjangoModelFactory):
class CountryFactory(DjangoModelFactory):
class Meta:
model = Country
django_get_or_create = ("code",)
Expand All @@ -51,7 +52,7 @@ class Meta:
name = "Sweden"


class LocaleFactory(factory.DjangoModelFactory):
class LocaleFactory(DjangoModelFactory):
class Meta:
model = Locale
django_get_or_create = ("code",)
Expand Down Expand Up @@ -82,7 +83,7 @@ def get_action_schemas():
return _action_schemas


class ActionFactory(factory.DjangoModelFactory):
class ActionFactory(DjangoModelFactory):
class Meta:
model = Action

Expand Down Expand Up @@ -122,7 +123,7 @@ def arguments_schema(self, create, extracted=None, **kwargs):
self.arguments_schema = {}


class RecipeFactory(factory.DjangoModelFactory):
class RecipeFactory(DjangoModelFactory):
class Meta:
model = Recipe

Expand Down Expand Up @@ -317,7 +318,7 @@ class BranchedAddonStudyArgumentsFactory(DictFactory):


@factory.use_strategy(factory.BUILD_STRATEGY)
class RecipeRevisionFactory(factory.DjangoModelFactory):
class RecipeRevisionFactory(DjangoModelFactory):
class Meta:
model = RecipeRevision

Expand Down Expand Up @@ -407,22 +408,22 @@ class BucketSampleFilterFactory(DictFactory):
count = factory.LazyAttribute(lambda o: factory.fuzzy.FuzzyInteger(0, o.total).fuzz())


class ApprovalRequestFactory(factory.DjangoModelFactory):
class ApprovalRequestFactory(DjangoModelFactory):
class Meta:
model = ApprovalRequest

revision = factory.SubFactory(RecipeRevisionFactory)


class EnabledStateFactory(factory.DjangoModelFactory):
class EnabledStateFactory(DjangoModelFactory):
class Meta:
model = EnabledState

creator = factory.SubFactory(UserFactory)
revision = factory.SubFactory(RecipeRevisionFactory)


class SignatureFactory(factory.DjangoModelFactory):
class SignatureFactory(DjangoModelFactory):
class Meta:
model = Signature
exclude = ["data"]
Expand Down
2 changes: 1 addition & 1 deletion normandy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Core(Configuration):
"product_details",
"rest_framework",
"graphene_django",
"drf_yasg",
"drf_yasg2",
"storages",
"raven.contrib.django.raven_compat",
"corsheaders",
Expand Down
3 changes: 2 additions & 1 deletion normandy/studies/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import tempfile
import zipfile
from factory.django import DjangoModelFactory

from normandy.base.tests import FuzzyUnicode
from normandy.studies.models import Extension
Expand Down Expand Up @@ -124,7 +125,7 @@ def generate_install_rdf(self, data):
self.add_file("install.rdf", INSTALL_RDF_TEMPLATE.format(insert).encode())


class ExtensionFactory(factory.DjangoModelFactory):
class ExtensionFactory(DjangoModelFactory):
name = FuzzyUnicode()
xpi = factory.django.FileField(from_func=lambda: WebExtensionFileFactory().open())

Expand Down
66 changes: 39 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ django-npm = "^1.0.0"
django-storages = "^1.7.2"
django_csp = "^3.5"
# DRF does not follow semver, 3.11 is a breaking change
djangorestframework = "3.10.*"
djangorestframework = "3.12.*"
djangorestframework-yaml = "^2.0.0"
dockerflow = "^2020.0.0"
drf-yasg = "^1.17.0"
drf-yasg2 = "^1.19.2"
ecdsa = "^0.16.0"
factory_boy = "^2.12.0"
factory_boy = "^3.0.0"
fastecdsa = "^1.7.4"
# Flake8 does not follow semver, and introduces backwards incompatible changes in minor updates
flake8 = "3.8.*"
Expand Down

0 comments on commit c7a3d01

Please sign in to comment.