MCPcopy Index your code
hub / github.com/python/cpython / test_special_attrs

Method test_special_attrs

Lib/test/test_http_cookies.py:201–222  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

199 'Set-Cookie: val="some\\054funky\\073stuff"')
200
201 def test_special_attrs(self):
202 # 'expires'
203 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
204 C['Customer']['expires'] = 0
205 # can't test exact output, it always depends on current date/time
206 self.assertEndsWith(C.output(), 'GMT')
207
208 # loading 'expires'
209 C = cookies.SimpleCookie()
210 C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
211 self.assertEqual(C['Customer']['expires'],
212 'Wed, 01 Jan 2010 00:00:00 GMT')
213 C = cookies.SimpleCookie()
214 C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
215 self.assertEqual(C['Customer']['expires'],
216 'Wed, 01 Jan 98 00:00:00 GMT')
217
218 # 'max-age'
219 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
220 C['Customer']['max-age'] = 10
221 self.assertEqual(C.output(),
222 'Set-Cookie: Customer="WILE_E_COYOTE"; Max-Age=10')
223
224 def test_set_secure_httponly_attrs(self):
225 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')

Callers

nothing calls this directly

Calls 4

assertEndsWithMethod · 0.80
outputMethod · 0.45
loadMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected