def test_empty(self): cookies = EncryptedCookieJar() self.assertEqual(cookies.get('x'), None) self.assertEqual(cookies.keys(), []) self.assertEqual(str(cookies), '') self.assertEqual(cookies, cookies) self.assertNotEqual(cookies, None)
def test_get(self): cookies = EncryptedCookieJar() for i in range(0, 10): c = Cookie(0, 'test{}'.format(i), 'value{}'.format(i), None, False, '.example.com', True, True, '/', False, True, None, False, None, None, {}) cookies.set_cookie(c) self.assertEqual(cookies.keys(), [ 'test0', 'test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8', 'test9' ]) for i in range(0, 10): name = 'test{}'.format(i) self.assertEqual(cookies[name], cookies.get(name)) self.assertEqual( str(cookies), 'test0=value0; test1=value1; test2=value2; test3=value3; test4=value4; test5=value5; test6=value6; test7=value7; test8=value8; test9=value9' )