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


Python ProofOfPossessionResponse.to_partial_json方法代码示例

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


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

示例1: ProofOfPossessionResponseTest

# 需要导入模块: from acme.challenges import ProofOfPossessionResponse [as 别名]
# 或者: from acme.challenges.ProofOfPossessionResponse import to_partial_json [as 别名]
class ProofOfPossessionResponseTest(unittest.TestCase):
    def setUp(self):
        # acme-spec uses a confusing example in which both signature
        # nonce and challenge nonce are the same, don't make the same
        # mistake here...
        signature = other.Signature(
            alg=jose.RS256,
            jwk=KEY.public_key(),
            sig=b"\xa7\xc1\xe7\xe82o\xbc\xcd\xd0\x1e\x010#Z|\xaf\x15\x83"
            b"\x94\x8f#\x9b\nQo(\x80\x15,\x08\xfcz\x1d\xfd\xfd.\xaap"
            b"\xfa\x06\xd1\xa2f\x8d8X2>%d\xbd%\xe1T\xdd\xaa0\x18\xde"
            b"\x99\x08\xf0\x0e{",
            nonce=b"\x99\xc7Q\xb3f2\xbc\xdci\xfe\xd6\x98k\xc67\xdf",
        )

        from acme.challenges import ProofOfPossessionResponse

        self.msg = ProofOfPossessionResponse(
            nonce=b"xD\xf9\xb9\xdbU\xed\xaa\x17\xf1y|\x81\x88\x99 ", signature=signature
        )

        self.jmsg_to = {
            "resource": "challenge",
            "type": "proofOfPossession",
            "nonce": "eET5udtV7aoX8Xl8gYiZIA",
            "signature": signature,
        }
        self.jmsg_from = {
            "resource": "challenge",
            "type": "proofOfPossession",
            "nonce": "eET5udtV7aoX8Xl8gYiZIA",
            "signature": signature.to_json(),
        }

    def test_verify(self):
        self.assertTrue(self.msg.verify())

    def test_to_partial_json(self):
        self.assertEqual(self.jmsg_to, self.msg.to_partial_json())

    def test_from_json(self):
        from acme.challenges import ProofOfPossessionResponse

        self.assertEqual(self.msg, ProofOfPossessionResponse.from_json(self.jmsg_from))

    def test_from_json_hashable(self):
        from acme.challenges import ProofOfPossessionResponse

        hash(ProofOfPossessionResponse.from_json(self.jmsg_from))
开发者ID:NEOatNHNG,项目名称:letsencrypt,代码行数:51,代码来源:challenges_test.py


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