當前位置: 首頁>>代碼示例>>Python>>正文


Python DummyRequest.received_cookies["testkey"]方法代碼示例

本文整理匯總了Python中shiji.testutil.DummyRequest.received_cookies["testkey"]方法的典型用法代碼示例。如果您正苦於以下問題:Python DummyRequest.received_cookies["testkey"]方法的具體用法?Python DummyRequest.received_cookies["testkey"]怎麽用?Python DummyRequest.received_cookies["testkey"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在shiji.testutil.DummyRequest的用法示例。


在下文中一共展示了DummyRequest.received_cookies["testkey"]方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_secure_cookie_invalid

# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import received_cookies["testkey"] [as 別名]
 def test_get_secure_cookie_invalid(self):
     "Test retrieving an invalid secure cookie."
     auth.install_secure_cookies(["supersecret"])
     raw_value = "testvalue"
     timestamp = "1360023531"
     signature = "badsig"
     secure_cookie_val = "%s|%s|%s" % (base64.b64encode(raw_value), timestamp, signature)
     request = DummyRequest()
     request.received_cookies["testkey"] = secure_cookie_val
     value = auth.get_secure_cookie(request, "testkey")
     self.assertTrue(isinstance(value, webapi.InvalidSecureCookieError))
開發者ID:notoriousno,項目名稱:shiji,代碼行數:13,代碼來源:test_init.py

示例2: test_get_secure_cookie_expired

# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import received_cookies["testkey"] [as 別名]
 def test_get_secure_cookie_expired(self):
     "Test retrieving an invalid secure cookie."
     auth.install_secure_cookies(["supersecret"])
     raw_value = "testvalue"
     timestamp = "1357260056"
     signature = "d304db1dbf1bc2fcb4eb6bc71bfd22cae4e74b74"
     secure_cookie_val = "%s|%s|%s" % (base64.b64encode(raw_value), timestamp, signature)
     request = DummyRequest()
     request.received_cookies["testkey"] = secure_cookie_val
     value = auth.get_secure_cookie(request, "testkey")
     self.assertTrue(isinstance(value, webapi.ExpiredSecureCookieError))
開發者ID:notoriousno,項目名稱:shiji,代碼行數:13,代碼來源:test_init.py

示例3: test_get_secure_cookie_ok

# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import received_cookies["testkey"] [as 別名]
 def test_get_secure_cookie_ok(self):
     "Validate retrieving a secure cookie."
     auth.install_secure_cookies(["supersecret"])
     raw_value = "testvalue"
     timestamp = "1360023531"
     signature = "e90904d67de2fd6e4d4f3c9a736e3b8c457526f9"
     secure_cookie_val = "%s|%s|%s" % (base64.b64encode(raw_value), timestamp, signature)
     request = DummyRequest()
     request.received_cookies["testkey"] = secure_cookie_val
     value = auth.get_secure_cookie(request, "testkey", expiry_days=36500)
     self.assertEqual(value, raw_value)
開發者ID:notoriousno,項目名稱:shiji,代碼行數:13,代碼來源:test_init.py


注:本文中的shiji.testutil.DummyRequest.received_cookies["testkey"]方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。