Skip to content

Commit

Permalink
Update expire date format on tests
Browse files Browse the repository at this point in the history
Correcting all tests involving cookies to use the correct date format
  • Loading branch information
huine authored Nov 23, 2018
1 parent 77f483a commit 39025ce
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ZPublisher/tests/testHTTPResponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_setCookie_no_attrs(self):
self.assertEqual(cookies[0], ('Set-Cookie', 'foo="bar"'))

def test_setCookie_w_expires(self):
EXPIRES = 'Wed, 31-Dec-97 23:59:59 GMT'
EXPIRES = 'Wed, 31 Dec 1997 23:59:59 GMT'
response = self._makeOne()
response.setCookie('foo', 'bar', expires=EXPIRES)
cookie = response.cookies.get('foo', None)
Expand Down Expand Up @@ -383,7 +383,8 @@ def test_expireCookie(self):
response.expireCookie('foo', path='/')
cookie = response.cookies.get('foo', None)
self.assertTrue(cookie)
self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT')
self.assertEqual(cookie.get('expires'),
'Wed, 31 Dec 1997 23:59:59 GMT')
self.assertEqual(cookie.get('max_age'), 0)
self.assertEqual(cookie.get('path'), '/')

Expand All @@ -392,10 +393,11 @@ def test_expireCookie1160(self):
# http://zope.org/Collectors/Zope/1160
response = self._makeOne()
response.expireCookie('foo', path='/',
expires='Mon, 22-Mar-2004 17:59 GMT', max_age=99)
expires='Mon, 22 Mar 2004 17:59 GMT', max_age=99)
cookie = response.cookies.get('foo', None)
self.assertTrue(cookie)
self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT')
self.assertEqual(cookie.get('expires'),
'Wed, 31 Dec 1997 23:59:59 GMT')
self.assertEqual(cookie.get('max_age'), 0)
self.assertEqual(cookie.get('path'), '/')

Expand Down Expand Up @@ -1068,7 +1070,7 @@ def test_listHeaders_after_expireCookie(self):
self.assertEqual(
set(cookie_header.split('; ')),
set(['qux="deleted"', 'Path=/', 'Max-Age=0',
'Expires=Wed, 31-Dec-97 23:59:59 GMT'])
'Expires=Wed, 31 Dec 1997 23:59:59 GMT'])
)

def test_listHeaders_after_addHeader(self):
Expand Down Expand Up @@ -1223,7 +1225,7 @@ def test___str__after_expireCookie(self):
self.assertEqual(
set(cookie_value.split(b'; ')),
set([b'qux="deleted"', b'Path=/', b'Max-Age=0',
b'Expires=Wed, 31-Dec-97 23:59:59 GMT'])
b'Expires=Wed, 31 Dec 1997 23:59:59 GMT'])
)

def test___str__after_addHeader(self):
Expand Down

0 comments on commit 39025ce

Please sign in to comment.