From f95a39744d2c31d9aab37072783d19a08c3a4d2e Mon Sep 17 00:00:00 2001 From: Agate Berriot Date: Wed, 27 Jul 2022 15:44:42 +0200 Subject: [PATCH] tests: fix broken tests after django-webtest upgrade (#67724) --- tests/settings.py | 10 ++++++++++ tests/test_lingo_payment.py | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/settings.py b/tests/settings.py index 08604dc5..3b45a2a5 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -112,3 +112,13 @@ USER_PROFILE_CONFIG = { LEGACY_URLS_MAPPING = {'old.org': 'new.org'} PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] + +REST_FRAMEWORK = { + # this is the default value but by explicitely setting it + # we avoid a collision with django-webtest erasing the setting + # while patching it + 'DEFAULT_AUTHENTICATION_CLASSES': [ + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.BasicAuthentication', + ] +} diff --git a/tests/test_lingo_payment.py b/tests/test_lingo_payment.py index fcca6b9f..f24c8a6d 100644 --- a/tests/test_lingo_payment.py +++ b/tests/test_lingo_payment.py @@ -2021,7 +2021,7 @@ def test_email_from_basket(app, regie, remote_invoices_httmock): # **Behaviours of PayView** # Logout - app.set_user() + app.set_user(None) app.session.flush() # email is mandatory for paying a remote invoice without being authenticated @@ -2063,7 +2063,7 @@ def test_email_from_basket(app, regie, remote_invoices_httmock): regie.save() # Logout - app.set_user() + app.set_user(None) app.session.flush() # Get a response to extract csrf_token