MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_special_attrs

Method test_special_attrs

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

Source from the content-addressed store, hash-verified

177 'Set-Cookie: val="some\\054funky\\073stuff"')
178
179 def test_special_attrs(self):
180 # 'expires'
181 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
182 C['Customer']['expires'] = 0
183 # can't test exact output, it always depends on current date/time
184 self.assertEndsWith(C.output(), 'GMT')
185
186 # loading 'expires'
187 C = cookies.SimpleCookie()
188 C.load('Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMT')
189 self.assertEqual(C['Customer']['expires'],
190 'Wed, 01 Jan 2010 00:00:00 GMT')
191 C = cookies.SimpleCookie()
192 C.load('Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMT')
193 self.assertEqual(C['Customer']['expires'],
194 'Wed, 01 Jan 98 00:00:00 GMT')
195
196 # 'max-age'
197 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')
198 C['Customer']['max-age'] = 10
199 self.assertEqual(C.output(),
200 'Set-Cookie: Customer="WILE_E_COYOTE"; Max-Age=10')
201
202 def test_set_secure_httponly_attrs(self):
203 C = cookies.SimpleCookie('Customer="WILE_E_COYOTE"')

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected