本文整理汇总了Python中passlib.context.CryptPolicy.get_options方法的典型用法代码示例。如果您正苦于以下问题:Python CryptPolicy.get_options方法的具体用法?Python CryptPolicy.get_options怎么用?Python CryptPolicy.get_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类passlib.context.CryptPolicy
的用法示例。
在下文中一共展示了CryptPolicy.get_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_13_get_options
# 需要导入模块: from passlib.context import CryptPolicy [as 别名]
# 或者: from passlib.context.CryptPolicy import get_options [as 别名]
def test_13_get_options(self):
"test get_options() method"
p12 = CryptPolicy(**self.sample_config_12pd)
self.assertEqual(p12.get_options("bsdi_crypt"),dict(
vary_rounds = "10%",
min_rounds = 29000,
max_rounds = 35000,
default_rounds = 31000,
))
self.assertEqual(p12.get_options("sha512_crypt"),dict(
vary_rounds = "10%",
min_rounds = 45000,
max_rounds = 50000,
))
p4 = CryptPolicy.from_string(self.sample_config_4s)
self.assertEqual(p4.get_options("sha512_crypt"), dict(
vary_rounds="10%",
max_rounds=20000,
))
self.assertEqual(p4.get_options("sha512_crypt", "user"), dict(
vary_rounds="10%",
max_rounds=20000,
))
self.assertEqual(p4.get_options("sha512_crypt", "admin"), dict(
vary_rounds="5%",
max_rounds=40000,
))
示例2: test_13_get_options
# 需要导入模块: from passlib.context import CryptPolicy [as 别名]
# 或者: from passlib.context.CryptPolicy import get_options [as 别名]
def test_13_get_options(self):
"test get_options() method"
p12 = CryptPolicy(**self.sample_config_12pd)
self.assertEqual(p12.get_options("bsdi_crypt"),dict(
# NOTE: not maintaining backwards compat for rendering to "10%"
vary_rounds = 0.1,
min_rounds = 29000,
max_rounds = 35000,
default_rounds = 31000,
))
self.assertEqual(p12.get_options("sha512_crypt"),dict(
# NOTE: not maintaining backwards compat for rendering to "10%"
vary_rounds = 0.1,
min_rounds = 45000,
max_rounds = 50000,
))
p4 = CryptPolicy.from_string(self.sample_config_4s)
self.assertEqual(p4.get_options("sha512_crypt"), dict(
# NOTE: not maintaining backwards compat for rendering to "10%"
vary_rounds=0.1,
max_rounds=20000,
))
self.assertEqual(p4.get_options("sha512_crypt", "user"), dict(
# NOTE: not maintaining backwards compat for rendering to "10%"
vary_rounds=0.1,
max_rounds=20000,
))
self.assertEqual(p4.get_options("sha512_crypt", "admin"), dict(
# NOTE: not maintaining backwards compat for rendering to "5%"
vary_rounds=0.05,
max_rounds=40000,
))