|
@@ -19,7 +19,9 @@ from django.contrib.sessions.backends.file import SessionStore as FileSession
|
|
|
from django.contrib.sessions.backends.signed_cookies import (
|
|
|
SessionStore as CookieSession,
|
|
|
)
|
|
|
-from django.contrib.sessions.exceptions import InvalidSessionKey
|
|
|
+from django.contrib.sessions.exceptions import (
|
|
|
+ InvalidSessionKey, SessionInterrupted,
|
|
|
+)
|
|
|
from django.contrib.sessions.middleware import SessionMiddleware
|
|
|
from django.contrib.sessions.models import Session
|
|
|
from django.contrib.sessions.serializers import (
|
|
@@ -28,7 +30,7 @@ from django.contrib.sessions.serializers import (
|
|
|
from django.core import management
|
|
|
from django.core.cache import caches
|
|
|
from django.core.cache.backends.base import InvalidCacheBackendError
|
|
|
-from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
|
|
|
+from django.core.exceptions import ImproperlyConfigured
|
|
|
from django.http import HttpResponse
|
|
|
from django.test import (
|
|
|
RequestFactory, SimpleTestCase, TestCase, ignore_warnings,
|
|
@@ -746,10 +748,10 @@ class SessionMiddlewareTests(TestCase):
|
|
|
"The request's session was deleted before the request completed. "
|
|
|
"The user may have logged out in a concurrent request, for example."
|
|
|
)
|
|
|
- with self.assertRaisesMessage(SuspiciousOperation, msg):
|
|
|
+ with self.assertRaisesMessage(SessionInterrupted, msg):
|
|
|
# Handle the response through the middleware. It will try to save
|
|
|
# the deleted session which will cause an UpdateError that's caught
|
|
|
- # and raised as a SuspiciousOperation.
|
|
|
+ # and raised as a SessionInterrupted.
|
|
|
middleware(request)
|
|
|
|
|
|
def test_session_delete_on_end(self):
|