Fix compatibility for older versions of Django
This commit is contained in:
parent
35532634fa
commit
26b2efe361
2 changed files with 11 additions and 4 deletions
|
@ -1,4 +1,8 @@
|
|||
from django.utils.deprecation import MiddlewareMixin
|
||||
try:
|
||||
# https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware
|
||||
from django.utils.deprecation import MiddlewareMixin
|
||||
except ImportError:
|
||||
MiddlewareMixin = object
|
||||
|
||||
from oidc_provider import settings
|
||||
from oidc_provider.lib.utils.common import get_browser_state_or_default
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf.urls import url
|
||||
from django.test import TestCase, override_settings
|
||||
from django.views import View
|
||||
from django.views.generic import View
|
||||
from mock import mock
|
||||
|
||||
|
||||
|
@ -10,10 +10,13 @@ class StubbedViews:
|
|||
|
||||
urlpatterns = [url('^test/', SampleView.as_view())]
|
||||
|
||||
MW_CLASSES = ('django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'oidc_provider.middleware.SessionManagementMiddleware')
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF=StubbedViews,
|
||||
MIDDLEWARE=('django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'oidc_provider.middleware.SessionManagementMiddleware'),
|
||||
MIDDLEWARE=MW_CLASSES,
|
||||
MIDDLEWARE_CLASSES=MW_CLASSES,
|
||||
OIDC_SESSION_MANAGEMENT_ENABLE=True)
|
||||
class MiddlewareTestCase(TestCase):
|
||||
|
||||
|
|
Loading…
Reference in a new issue