File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1- from django .conf .global_settings import MIDDLEWARE_CLASSES
21from django .contrib .auth import get_user_model
32from django .contrib .auth .models import AnonymousUser
43from django .test import TestCase , RequestFactory
109from ..models import AccessToken
1110from ..backends import OAuth2Backend
1211from ..middleware import OAuth2TokenMiddleware
12+ try :
13+ # Django<1.10 compatibility
14+ from django .conf .global_settings import MIDDLEWARE_CLASSES as MIDDLEWARE
15+ except ImportError :
16+ from django .conf .global_settings import MIDDLEWARE
17+
1318
1419UserModel = get_user_model ()
1520ApplicationModel = get_application_model ()
@@ -76,7 +81,9 @@ def test_get_user(self):
7681 'oauth2_provider.backends.OAuth2Backend' ,
7782 'django.contrib.auth.backends.ModelBackend' ,
7883 ),
79- MIDDLEWARE_CLASSES = tuple (MIDDLEWARE_CLASSES ) + ('oauth2_provider.middleware.OAuth2TokenMiddleware' ,)
84+ MIDDLEWARE = tuple (MIDDLEWARE ) + ('oauth2_provider.middleware.OAuth2TokenMiddleware' ,),
85+ # Django<1.10 compat:
86+ MIDDLEWARE_CLASSES = tuple (MIDDLEWARE ) + ('oauth2_provider.middleware.OAuth2TokenMiddleware' ,)
8087)
8188class TestOAuth2Middleware (BaseTest ):
8289
You can’t perform that action at this time.
0 commit comments