当前位置: 首页>>代码示例>>Python>>正文


Python AuthHandler._challenge_factory方法代码示例

本文整理汇总了Python中letsencrypt.auth_handler.AuthHandler._challenge_factory方法的典型用法代码示例。如果您正苦于以下问题:Python AuthHandler._challenge_factory方法的具体用法?Python AuthHandler._challenge_factory怎么用?Python AuthHandler._challenge_factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在letsencrypt.auth_handler.AuthHandler的用法示例。


在下文中一共展示了AuthHandler._challenge_factory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ChallengeFactoryTest

# 需要导入模块: from letsencrypt.auth_handler import AuthHandler [as 别名]
# 或者: from letsencrypt.auth_handler.AuthHandler import _challenge_factory [as 别名]
class ChallengeFactoryTest(unittest.TestCase):
    # pylint: disable=protected-access

    def setUp(self):
        from letsencrypt.auth_handler import AuthHandler

        # Account is mocked...
        self.handler = AuthHandler(None, None, mock.Mock(key="mock_key"))

        self.dom = "test"
        self.handler.authzr[self.dom] = acme_util.gen_authzr(
            messages.STATUS_PENDING, self.dom, acme_util.CHALLENGES,
            [messages.STATUS_PENDING] * 6, False)

    def test_all(self):
        achalls = self.handler._challenge_factory(
            self.dom, range(0, len(acme_util.CHALLENGES)))

        self.assertEqual(
            [achall.chall for achall in achalls], acme_util.CHALLENGES)

    def test_one_tls_sni(self):
        achalls = self.handler._challenge_factory(self.dom, [1])

        self.assertEqual(
            [achall.chall for achall in achalls], [acme_util.TLSSNI01])

    def test_unrecognized(self):
        self.handler.authzr["failure.com"] = acme_util.gen_authzr(
            messages.STATUS_PENDING, "failure.com",
            [mock.Mock(chall="chall", typ="unrecognized")],
            [messages.STATUS_PENDING])

        self.assertRaises(
            errors.Error, self.handler._challenge_factory, "failure.com", [0])
开发者ID:HenryKamg,项目名称:letsencrypt,代码行数:37,代码来源:auth_handler_test.py

示例2: ChallengeFactoryTest

# 需要导入模块: from letsencrypt.auth_handler import AuthHandler [as 别名]
# 或者: from letsencrypt.auth_handler.AuthHandler import _challenge_factory [as 别名]
class ChallengeFactoryTest(unittest.TestCase):
    # pylint: disable=protected-access

    def setUp(self):
        from letsencrypt.auth_handler import AuthHandler

        # Account is mocked...
        self.handler = AuthHandler(
            None, None, None, mock.Mock(key="mock_key"))

        self.dom = "test"
        self.handler.authzr[self.dom] = acme_util.gen_authzr(
            messages.STATUS_PENDING, self.dom, acme_util.CHALLENGES,
            [messages.STATUS_PENDING]*6, False)

    def test_all(self):
        cont_c, dv_c = self.handler._challenge_factory(self.dom, range(0, 6))

        self.assertEqual(
            [achall.chall for achall in cont_c], acme_util.CONT_CHALLENGES)
        self.assertEqual(
            [achall.chall for achall in dv_c], acme_util.DV_CHALLENGES)

    def test_one_dv_one_cont(self):
        cont_c, dv_c = self.handler._challenge_factory(self.dom, [1, 4])

        self.assertEqual(
            [achall.chall for achall in cont_c], [acme_util.RECOVERY_TOKEN])
        self.assertEqual([achall.chall for achall in dv_c], [acme_util.DVSNI])

    def test_unrecognized(self):
        self.handler.authzr["failure.com"] = acme_util.gen_authzr(
            messages.STATUS_PENDING, "failure.com",
            [mock.Mock(chall="chall", typ="unrecognized")],
            [messages.STATUS_PENDING])

        self.assertRaises(errors.LetsEncryptClientError,
                          self.handler._challenge_factory, "failure.com", [0])
开发者ID:coolaj86,项目名称:lets-encrypt-preview,代码行数:40,代码来源:auth_handler_test.py


注:本文中的letsencrypt.auth_handler.AuthHandler._challenge_factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。