Projet

Général

Profil

0002-Fixed-Django-3.2-related-test-failures.patch

A. Berriot, 28 juillet 2022 16:24

Télécharger (2,54 ko)

Voir les différences:

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(-)
passerelle/utils/__init__.py
31 31
from django.core.exceptions import PermissionDenied
32 32
from django.db import transaction
33 33
from django.http import HttpResponse, HttpResponseBadRequest
34
from django.utils.decorators import available_attrs
35 34
from django.utils.encoding import force_bytes, force_text
36 35
from django.utils.functional import lazy
37 36
from django.utils.html import mark_safe
......
164 163

  
165 164
def protected_api(perm):
166 165
    def decorator(view_func):
167
        @wraps(view_func, assigned=available_attrs(view_func))
166
        @wraps(view_func)
168 167
        def _wrapped_view(instance, request, *args, **kwargs):
169 168
            if not isinstance(instance, SingleObjectMixin):
170 169
                raise Exception("protected_api must be applied on a method of a class based view")
tests/test_proxylogger.py
376 376

  
377 377
    monkeypatch.setattr(Feed, 'json', json)
378 378
    app.get(endpoint_url, status=500)
379
    assert any('Traceback:' in mail.body for mail in mailoutbox)
379

  
380
    assert any('Exception Type: ConnectionError' in mail.body for mail in mailoutbox)
380 381

  
381 382

  
382 383
def test_proxy_logger_bytes(db, connector):
tests/test_toulouse_smart.py
773 773
    url = URL + 'update-intervention?uuid=0123456789'
774 774
    resp = app.post_json(url, params=UPDATE_INTERVENTION_PAYLOAD, status=400)
775 775
    assert resp.json['err']
776
    assert "'0123456789' is not a valid UUID." in resp.json['err_desc']
776
    assert 'is not a valid UUID.' in resp.json['err_desc']
777 777
    assert SmartRequest.objects.count() == 0
778 778

  
779 779
    url = URL + 'update-intervention?uuid=%s' % str(UUID)
780
-