diff --git a/Dockerfile b/Dockerfile index 4dbdfcd..0214b95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6.13-slim-buster@sha256:596c35c09d59adf2afbefa3aa970f26ac3ba3c2396c6766a7c73086ac850d416 +FROM python:3.9.6-slim-buster WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends libpq-dev wget build-essential \ diff --git a/emeis/core/apps.py b/emeis/core/apps.py index c77cd09..ec1f5c1 100644 --- a/emeis/core/apps.py +++ b/emeis/core/apps.py @@ -8,7 +8,7 @@ class DefaultConfig(AppConfig): label = "emeis_core" def ready(self): - from .models import VisibilityMixin, PermissionMixin + from .models import PermissionMixin, VisibilityMixin # to avoid recursive import error, load extension classes # only once the app is ready diff --git a/emeis/core/tests/test_api.py b/emeis/core/tests/test_api.py index f8ffa41..54a4ff4 100644 --- a/emeis/core/tests/test_api.py +++ b/emeis/core/tests/test_api.py @@ -86,7 +86,10 @@ def viewset(request): @pytest.fixture def fixture( - deterministic_uuids, django_db_reset_sequences, request, viewset, + deterministic_uuids, + django_db_reset_sequences, + request, + viewset, ): """Get fixture and many to many relations of given viewset.""" fixture = request.getfixturevalue(viewset.factory_name) diff --git a/emeis/core/tests/test_visibility.py b/emeis/core/tests/test_visibility.py index 439e735..462422b 100644 --- a/emeis/core/tests/test_visibility.py +++ b/emeis/core/tests/test_visibility.py @@ -58,12 +58,15 @@ def filter_queryset_for_user(self, queryset, request): if not detail: if use_admin_client: assert len(result["data"]) == 2 - assert sorted( - [ - result["data"][0]["attributes"]["username"], - result["data"][1]["attributes"]["username"], - ] - ) == ["admin", "foo"] + assert ( + sorted( + [ + result["data"][0]["attributes"]["username"], + result["data"][1]["attributes"]["username"], + ] + ) + == ["admin", "foo"] + ) else: assert len(result["data"]) == 0 else: diff --git a/emeis/oidc_auth/tests/test_authentication.py b/emeis/oidc_auth/tests/test_authentication.py index f8e381c..79c2941 100644 --- a/emeis/oidc_auth/tests/test_authentication.py +++ b/emeis/oidc_auth/tests/test_authentication.py @@ -66,7 +66,13 @@ def test_authentication( [(False, "", 0), (True, "", 1), (True, "foo@example.com", 1)], ) def test_authentication_new_user( - db, rf, requests_mock, settings, create_user, email, expected_count, + db, + rf, + requests_mock, + settings, + create_user, + email, + expected_count, ): settings.OIDC_CREATE_USER = create_user settings.OIDC_UPDATE_USER = create_user @@ -93,7 +99,12 @@ def test_authentication_new_user( [("1", "foo@example.com", "bar@example.com")], ) def test_authentication_email_update( - db, rf, requests_mock, settings, user, expected_email, + db, + rf, + requests_mock, + settings, + user, + expected_email, ): settings.OIDC_UPDATE_USER = True userinfo = {"sub": "1", "email": expected_email} @@ -106,7 +117,10 @@ def test_authentication_email_update( def test_authentication_idp_502( - db, rf, requests_mock, settings, + db, + rf, + requests_mock, + settings, ): requests_mock.get( settings.OIDC_OP_USER_ENDPOINT, status_code=status.HTTP_502_BAD_GATEWAY @@ -118,7 +132,10 @@ def test_authentication_idp_502( def test_authentication_idp_missing_claim( - db, rf, requests_mock, settings, + db, + rf, + requests_mock, + settings, ): settings.OIDC_USERNAME_CLAIM = "missing" userinfo = {"sub": "1"} @@ -130,7 +147,10 @@ def test_authentication_idp_missing_claim( def test_authentication_no_client( - db, rf, requests_mock, settings, + db, + rf, + requests_mock, + settings, ): requests_mock.get( settings.OIDC_OP_USER_ENDPOINT, status_code=status.HTTP_401_UNAUTHORIZED diff --git a/emeis/urls.py b/emeis/urls.py index 2fa15da..304123f 100644 --- a/emeis/urls.py +++ b/emeis/urls.py @@ -1,6 +1,4 @@ from django.conf.urls import include from django.urls import path -urlpatterns = [ - path("api/v1/", include("emeis.core.urls"),), -] +urlpatterns = [path("api/v1/", include("emeis.core.urls"))] diff --git a/requirements-base.txt b/requirements-base.txt index 0b6d3f0..2bc4d61 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -1,5 +1,5 @@ -django==2.2.20 -django-cors-headers==3.4.0 +django==2.2.24 +django-cors-headers==3.7.0 django-environ==0.4.5 django-filter==2.3.0 django-localized-fields==5.4.2 @@ -7,6 +7,6 @@ django_mptt==0.11.0 django-postgres-extra==1.22 djangorestframework==3.12.4 djangorestframework-jsonapi==4.1.0 -mozilla-django-oidc==1.2.3 -requests==2.24.0 +mozilla-django-oidc==1.2.4 +requests==2.26.0 uwsgi==2.0.19.1 diff --git a/requirements-dev.txt b/requirements-dev.txt index 660aad3..9489d3b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,23 +1,23 @@ -r requirements-base.txt -black==19.10b0 +black==21.5b1 django_extensions==3.0.8 -factory-boy==2.12.0 +factory-boy==3.2.0 flake8==3.8.3 -flake8-blind-except==0.1.1 -flake8-bugbear==20.1.4 +flake8-blind-except==0.2.0 +flake8-bugbear==21.4.3 flake8-debugger==3.2.1 flake8-docstrings==1.5.0 -flake8-isort==3.0.1 +flake8-isort==4.0.0 flake8-string-format==0.3.0 flake8-tuple==0.4.1 -gitlint==0.13.1 -hypothesis==5.33.0 +gitlint==0.15.1 +hypothesis==6.13.0 ipython==7.16.1 -isort==4.3.21 +isort==5.8.0 pdbpp==0.10.2 pre_commit==2.7.1 psycopg2-binary==2.8.6 -pytest==6.0.1 +pytest==6.2.4 pytest-cov==2.10.1 pytest-django==3.9.0 pytest-env==0.6.2 @@ -27,4 +27,4 @@ pytest-mock==3.3.1 pytest-randomly==3.4.1 requests-mock==1.8.0 snapshottest==0.5.1 -werkzeug==1.0.1 +werkzeug==2.0.1 diff --git a/requirements-prod.txt b/requirements-prod.txt index 5fa76fa..b99b48e 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,2 +1,2 @@ -r requirements-base.txt -psycopg2==2.8.5 +psycopg2==2.8.6 diff --git a/setup.cfg b/setup.cfg index 1200363..e562369 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,6 +40,8 @@ DJANGO_SETTINGS_MODULE = emeis.settings filterwarnings = error::DeprecationWarning error::PendingDeprecationWarning + # We don't use LocalizedAutoSlug, but it still keeps warning, so we ignore it for now + ignore:LocalizedAutoSlug is deprecated and will be removed in the next major version. env = ADMINS=Test Example ,Test2 LANGUAGES=en,de,fr