summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexey <lesha.ogonkov@gmail.com>2017-12-28 00:49:46 +0300
committerTim Graham <timograham@gmail.com>2018-01-02 11:22:59 -0500
commit0afffae4ecb660f2ecb94a756c2ab7729654ecf6 (patch)
tree70bab826d6925834a9d43b27c90a8ff592653a8b /tests
parent5f456408a0f52dc16f627d4a89ced5f52c36ad2f (diff)
Fixed #28965 -- Updated Set-Cookie's Expires date format to follow RFC 7231.
Diffstat (limited to 'tests')
-rw-r--r--tests/messages_tests/test_cookie.py2
-rw-r--r--tests/requests/tests.py8
-rw-r--r--tests/sessions_tests/tests.py8
3 files changed, 9 insertions, 9 deletions
diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py
index 68dea51bcf..a5eff30fd4 100644
--- a/tests/messages_tests/test_cookie.py
+++ b/tests/messages_tests/test_cookie.py
@@ -82,7 +82,7 @@ class CookieTests(BaseTests, SimpleTestCase):
storage.update(response)
self.assertEqual(response.cookies['messages'].value, '')
self.assertEqual(response.cookies['messages']['domain'], '.example.com')
- self.assertEqual(response.cookies['messages']['expires'], 'Thu, 01-Jan-1970 00:00:00 GMT')
+ self.assertEqual(response.cookies['messages']['expires'], 'Thu, 01 Jan 1970 00:00:00 GMT')
def test_get_bad_cookie(self):
request = self.get_request()
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 4c26bccf4e..fdc2e06e18 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -14,7 +14,7 @@ from django.http.request import split_domain_port
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.client import FakePayload
from django.test.utils import freeze_time
-from django.utils.http import cookie_date
+from django.utils.http import http_date
from django.utils.timezone import utc
@@ -234,7 +234,7 @@ class RequestsTests(SimpleTestCase):
response.set_cookie('c', 'old-value')
self.assertEqual(response.cookies['c']['expires'], '')
response.delete_cookie('c')
- self.assertEqual(response.cookies['c']['expires'], 'Thu, 01-Jan-1970 00:00:00 GMT')
+ self.assertEqual(response.cookies['c']['expires'], 'Thu, 01 Jan 1970 00:00:00 GMT')
response.set_cookie('c', 'new-value')
self.assertEqual(response.cookies['c']['expires'], '')
@@ -246,7 +246,7 @@ class RequestsTests(SimpleTestCase):
self.assertIn(
datetime_cookie['expires'],
# assertIn accounts for slight time dependency (#23450)
- ('Sat, 01-Jan-2028 04:05:06 GMT', 'Sat, 01-Jan-2028 04:05:07 GMT')
+ ('Sat, 01 Jan 2028 04:05:06 GMT', 'Sat, 01 Jan 2028 04:05:07 GMT')
)
def test_max_age_expiration(self):
@@ -257,7 +257,7 @@ class RequestsTests(SimpleTestCase):
response.set_cookie('max_age', max_age=10)
max_age_cookie = response.cookies['max_age']
self.assertEqual(max_age_cookie['max-age'], 10)
- self.assertEqual(max_age_cookie['expires'], cookie_date(set_cookie_time + 10))
+ self.assertEqual(max_age_cookie['expires'], http_date(set_cookie_time + 10))
def test_httponly_cookie(self):
response = HttpResponse()
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
index 3a3af1613a..f70c8ca1e6 100644
--- a/tests/sessions_tests/tests.py
+++ b/tests/sessions_tests/tests.py
@@ -730,9 +730,9 @@ class SessionMiddlewareTests(TestCase):
# The cookie was deleted, not recreated.
# 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(
- '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,
),
@@ -758,11 +758,11 @@ class SessionMiddlewareTests(TestCase):
# The cookie was deleted, not recreated.
# A deleted cookie header with a custom domain and path looks like:
# Set-Cookie: sessionid=; Domain=.example.local;
- # expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0;
+ # expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0;
# Path=/example/
self.assertEqual(
'Set-Cookie: {}=""; Domain=.example.local; expires=Thu, '
- '01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/example/'.format(
+ '01 Jan 1970 00:00:00 GMT; Max-Age=0; Path=/example/'.format(
settings.SESSION_COOKIE_NAME,
),
str(response.cookies[settings.SESSION_COOKIE_NAME])