diff options
Diffstat (limited to 'tests/httpwrappers')
| -rw-r--r-- | tests/httpwrappers/tests.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py index 4e705e2aeb..cc324b76cd 100644 --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -631,7 +631,7 @@ class CookieTests(unittest.TestCase): c = SimpleCookie() c['test'] = "An,awkward;value" c2 = SimpleCookie() - c2.load(c.output()) + c2.load(c.output()[12:]) self.assertEqual(c['test'].value, c2['test'].value) def test_decode_2(self): @@ -641,7 +641,7 @@ class CookieTests(unittest.TestCase): c = SimpleCookie() c['test'] = b"\xf0" c2 = SimpleCookie() - c2.load(c.output()) + c2.load(c.output()[12:]) self.assertEqual(c['test'].value, c2['test'].value) def test_nonstandard_keys(self): @@ -678,3 +678,15 @@ class CookieTests(unittest.TestCase): r = HttpResponse() r.set_cookie("a:.b/", 1) self.assertEqual(len(r.cookies.bad_cookies), 1) + + def test_pickle(self): + rawdata = 'Customer="WILE_E_COYOTE"; Path=/acme; Version=1' + expected_output = 'Set-Cookie: %s' % rawdata + + C = SimpleCookie() + C.load(rawdata) + self.assertEqual(C.output(), expected_output) + + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + C1 = pickle.loads(pickle.dumps(C, protocol=proto)) + self.assertEqual(C1.output(), expected_output) |
