1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #13152 -- Ensure the test client saves the session before writing the session key to the cookie, in case the session engine changes the session key.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12806 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-03-19 05:42:13 +00:00
parent 003fe52225
commit f081059b45
3 changed files with 54 additions and 3 deletions

View File

@@ -428,6 +428,9 @@ class Client(object):
request.session = engine.SessionStore()
login(request, user)
# Save the session values.
request.session.save()
# Set the cookie to represent the session.
session_cookie = settings.SESSION_COOKIE_NAME
self.cookies[session_cookie] = request.session.session_key
@@ -440,9 +443,6 @@ class Client(object):
}
self.cookies[session_cookie].update(cookie_data)
# Save the session values.
request.session.save()
return True
else:
return False