From e92863fe0c49c781131973d2fee38d6c9433ab15 Mon Sep 17 00:00:00 2001 From: Tom Wojcik Date: Fri, 7 Jun 2024 12:34:38 +0200 Subject: [PATCH] merge decorators in tests for better readability --- .../testapp/tests/test_token_create.py | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/testproject/testapp/tests/test_token_create.py b/testproject/testapp/tests/test_token_create.py index 4291e142..028decae 100644 --- a/testproject/testapp/tests/test_token_create.py +++ b/testproject/testapp/tests/test_token_create.py @@ -42,10 +42,8 @@ def test_post_should_login_user(self): @override_settings( AUTHENTICATION_BACKENDS=[ "django.contrib.auth.backends.ModelBackend", - ] - ) - @override_settings( - DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "username"}) + ], + DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "username"}), ) def test_login__LOGIN_FIELD_username__USERNAME_FIELD_username( self, @@ -97,9 +95,9 @@ def test_login__LOGIN_FIELD_username__USERNAME_FIELD_username( @override_settings( AUTHENTICATION_BACKENDS=[ "django.contrib.auth.backends.ModelBackend", - ] + ], + DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "email"}), ) - @override_settings(DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "email"})) def test_login__LOGIN_FIELD_email__USERNAME_FIELD_username( self, ): @@ -149,10 +147,8 @@ def test_login__LOGIN_FIELD_email__USERNAME_FIELD_username( @override_settings( AUTHENTICATION_BACKENDS=[ "django.contrib.auth.backends.ModelBackend", - ] - ) - @override_settings( - DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "username"}) + ], + DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "username"}), ) def test_login__LOGIN_FIELD_username__USERNAME_FIELD_email( self, @@ -203,9 +199,9 @@ def test_login__LOGIN_FIELD_username__USERNAME_FIELD_email( @override_settings( AUTHENTICATION_BACKENDS=[ "django.contrib.auth.backends.ModelBackend", - ] + ], + DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "email"}), ) - @override_settings(DJOSER=dict(django_settings.DJOSER, **{"LOGIN_FIELD": "email"})) def test_login__LOGIN_FIELD_email__USERNAME_FIELD_email( self, ):