[1.8.x] Fixed sessions test on Python 3.5; refs #23763.

SimpleCookie.__repr__() changed in
https://hg.python.org/cpython/rev/88e1151e8e02

Backport of 4e59156c10 from master
This commit is contained in:
Tim Graham 2015-03-30 12:29:56 -04:00
parent 793ecf6db7
commit 7b9f7b6670
1 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import base64
import os import os
import shutil import shutil
import string import string
import sys
import tempfile import tempfile
import unittest import unittest
from datetime import timedelta from datetime import timedelta
@ -601,8 +602,11 @@ class SessionMiddlewareTests(TestCase):
# A deleted cookie header looks like: # A deleted cookie header looks like:
# Set-Cookie: sessionid=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/ # Set-Cookie: sessionid=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
self.assertEqual( self.assertEqual(
'Set-Cookie: {}=; expires=Thu, 01-Jan-1970 00:00:00 GMT; ' 'Set-Cookie: {}={}; expires=Thu, 01-Jan-1970 00:00:00 GMT; '
'Max-Age=0; Path=/'.format(settings.SESSION_COOKIE_NAME), 'Max-Age=0; Path=/'.format(
settings.SESSION_COOKIE_NAME,
'""' if sys.version_info >= (3, 5) else '',
),
str(response.cookies[settings.SESSION_COOKIE_NAME]) str(response.cookies[settings.SESSION_COOKIE_NAME])
) )