Skip to content

Commit cc65bae

Browse files
committed
tests: Use modify_settings() instead of override_settings()
1 parent 943d9ff commit cc65bae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_auth_backends.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from django.conf.global_settings import MIDDLEWARE
21
from django.contrib.auth import get_user_model
32
from django.contrib.auth.models import AnonymousUser
43
from django.http import HttpResponse
54
from django.test import RequestFactory, TestCase
6-
from django.test.utils import override_settings
5+
from django.test.utils import modify_settings, override_settings
76
from django.utils.timezone import now, timedelta
87

98
from oauth2_provider.backends import OAuth2Backend
@@ -80,7 +79,11 @@ def test_get_user(self):
8079
"oauth2_provider.backends.OAuth2Backend",
8180
"django.contrib.auth.backends.ModelBackend",
8281
),
83-
MIDDLEWARE=tuple(MIDDLEWARE) + ("oauth2_provider.middleware.OAuth2TokenMiddleware", ),
82+
)
83+
@modify_settings(
84+
MIDDLEWARE={
85+
"append": "oauth2_provider.middleware.OAuth2TokenMiddleware",
86+
}
8487
)
8588
class TestOAuth2Middleware(BaseTest):
8689

0 commit comments

Comments
 (0)