本文整理汇总了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)