[Zope-Checkins] CVS: Zope/lib/python/ZPublisher/tests -
testHTTPResponse.py:1.1.4.2
Stefan H. Holek
stefan at epy.co.at
Mon Apr 26 06:11:24 EDT 2004
Update of /cvs-repository/Zope/lib/python/ZPublisher/tests
In directory cvs.zope.org:/tmp/cvs-serv14785/lib/python/ZPublisher/tests
Modified Files:
Tag: Zope-2_7-branch
testHTTPResponse.py
Log Message:
Collector #1160: HTTPResponse.expireCookie() potentially didn't
when an 'expires' keyword argument was passed.
=== Zope/lib/python/ZPublisher/tests/testHTTPResponse.py 1.1.4.1 => 1.1.4.2 ===
--- Zope/lib/python/ZPublisher/tests/testHTTPResponse.py:1.1.4.1 Mon Nov 17 17:34:20 2003
+++ Zope/lib/python/ZPublisher/tests/testHTTPResponse.py Mon Apr 26 06:11:24 2004
@@ -28,6 +28,43 @@
response.setStatus(exc_type)
self.assertEqual(response.status, code)
+ def test_setCookie(self):
+ response = self._makeOne()
+ response.setCookie('foo', 'bar', path='/')
+ cookie = response.cookies.get('foo', None)
+ self.failUnless(cookie)
+ self.assertEqual(cookie.get('value'), 'bar')
+ self.assertEqual(cookie.get('path'), '/')
+
+ def test_expireCookie(self):
+ response = self._makeOne()
+ response.expireCookie('foo', path='/')
+ cookie = response.cookies.get('foo', None)
+ self.failUnless(cookie)
+ self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT')
+ self.assertEqual(cookie.get('max_age'), 0)
+ self.assertEqual(cookie.get('path'), '/')
+
+ def test_expireCookie1160(self):
+ # Verify that the cookie is expired even if an expires kw arg is passed
+ # http://zope.org/Collectors/Zope/1160
+ response = self._makeOne()
+ response.expireCookie('foo', path='/', expires='Mon, 22-Mar-2004 17:59 GMT', max_age=99)
+ cookie = response.cookies.get('foo', None)
+ self.failUnless(cookie)
+ self.assertEqual(cookie.get('expires'), 'Wed, 31-Dec-97 23:59:59 GMT')
+ self.assertEqual(cookie.get('max_age'), 0)
+ self.assertEqual(cookie.get('path'), '/')
+
+ def test_appendCookie(self):
+ response = self._makeOne()
+ response.setCookie('foo', 'bar', path='/')
+ response.appendCookie('foo', 'baz')
+ cookie = response.cookies.get('foo', None)
+ self.failUnless(cookie)
+ self.assertEqual(cookie.get('value'), 'bar:baz')
+ self.assertEqual(cookie.get('path'), '/')
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(HTTPResponseTests, 'test'))
More information about the Zope-Checkins
mailing list