本文整理匯總了Python中browserid.LocalVerifier.fetch_public_key方法的典型用法代碼示例。如果您正苦於以下問題:Python LocalVerifier.fetch_public_key方法的具體用法?Python LocalVerifier.fetch_public_key怎麽用?Python LocalVerifier.fetch_public_key使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類browserid.LocalVerifier
的用法示例。
在下文中一共展示了LocalVerifier.fetch_public_key方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_cache_eviction_based_on_time
# 需要導入模塊: from browserid import LocalVerifier [as 別名]
# 或者: from browserid.LocalVerifier import fetch_public_key [as 別名]
def test_cache_eviction_based_on_time(self):
certs = CertificatesManager(FIFOCache(cache_timeout=0.1))
verifier = LocalVerifier(["*"], certs=certs, warning=False)
# Prime the cache by verifying an assertion.
assertion = make_assertion("[email protected]", "")
self.assertTrue(verifier.verify(assertion))
# Make it error out if re-fetching the keys
with patched_key_fetching(exc=RuntimeError("key fetch disabled")):
verifier.fetch_public_key = fetch_public_key
# It should be in the cache, so this works fine.
verifier.verify(assertion)
# But after sleeping it gets evicted and the error is triggered.
time.sleep(0.1)
self.assertRaises(RuntimeError, verifier.verify, assertion)