From e1d0f254379f31ff94c8d54278d6ef8275be8b26 Mon Sep 17 00:00:00 2001 From: Agate Date: Thu, 28 Jul 2022 15:46:53 +0200 Subject: [PATCH 2/4] Fixed Django 3.2 related test failures --- passerelle/utils/__init__.py | 3 +-- tests/test_proxylogger.py | 3 ++- tests/test_toulouse_smart.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/passerelle/utils/__init__.py b/passerelle/utils/__init__.py index 95b67e9d..f4a64ab8 100644 --- a/passerelle/utils/__init__.py +++ b/passerelle/utils/__init__.py @@ -31,7 +31,6 @@ from django.core.cache import cache from django.core.exceptions import PermissionDenied from django.db import transaction from django.http import HttpResponse, HttpResponseBadRequest -from django.utils.decorators import available_attrs from django.utils.encoding import force_bytes, force_text from django.utils.functional import lazy from django.utils.html import mark_safe @@ -164,7 +163,7 @@ def is_authorized(request, obj, perm): def protected_api(perm): def decorator(view_func): - @wraps(view_func, assigned=available_attrs(view_func)) + @wraps(view_func) def _wrapped_view(instance, request, *args, **kwargs): if not isinstance(instance, SingleObjectMixin): raise Exception("protected_api must be applied on a method of a class based view") diff --git a/tests/test_proxylogger.py b/tests/test_proxylogger.py index c8205b1e..41fb464c 100644 --- a/tests/test_proxylogger.py +++ b/tests/test_proxylogger.py @@ -376,7 +376,8 @@ def test_proxy_logger_email_traceback(app, db, email_handler, settings, mailoutb monkeypatch.setattr(Feed, 'json', json) app.get(endpoint_url, status=500) - assert any('Traceback:' in mail.body for mail in mailoutbox) + + assert any('Exception Type: ConnectionError' in mail.body for mail in mailoutbox) def test_proxy_logger_bytes(db, connector): diff --git a/tests/test_toulouse_smart.py b/tests/test_toulouse_smart.py index 86cc614d..f52e89e9 100644 --- a/tests/test_toulouse_smart.py +++ b/tests/test_toulouse_smart.py @@ -773,7 +773,7 @@ def test_update_intervention_wrong_uuid(app, smart): url = URL + 'update-intervention?uuid=0123456789' resp = app.post_json(url, params=UPDATE_INTERVENTION_PAYLOAD, status=400) assert resp.json['err'] - assert "'0123456789' is not a valid UUID." in resp.json['err_desc'] + assert 'is not a valid UUID.' in resp.json['err_desc'] assert SmartRequest.objects.count() == 0 url = URL + 'update-intervention?uuid=%s' % str(UUID) -- 2.36.1