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


Python messages.Registration类代码示例

本文整理汇总了Python中acme.messages.Registration的典型用法代码示例。如果您正苦于以下问题:Python Registration类的具体用法?Python Registration怎么用?Python Registration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_from_data

 def test_from_data(self):
     from acme.messages import Registration
     reg = Registration.from_data(phone='1234', email='[email protected]')
     self.assertEqual(reg.contact, (
         'tel:1234',
         'mailto:[email protected]',
     ))
开发者ID:g1franc,项目名称:lets-encrypt-preview,代码行数:7,代码来源:messages_test.py

示例2: RegistrationTest

class RegistrationTest(unittest.TestCase):
    """Tests for acme.messages.Registration."""

    def setUp(self):
        key = jose.jwk.JWKRSA(key=KEY.publickey())
        contact = (
            'mailto:[email protected]',
            'tel:1234',
        )
        recovery_token = 'XYZ'
        agreement = 'https://letsencrypt.org/terms'

        from acme.messages import Registration
        self.reg = Registration(
            key=key, contact=contact, recovery_token=recovery_token,
            agreement=agreement)

        self.jobj_to = {
            'contact': contact,
            'recoveryToken': recovery_token,
            'agreement': agreement,
            'key': key,
        }
        self.jobj_from = self.jobj_to.copy()
        self.jobj_from['key'] = key.to_json()

    def test_from_data(self):
        from acme.messages import Registration
        reg = Registration.from_data(phone='1234', email='[email protected]')
        self.assertEqual(reg.contact, (
            'tel:1234',
            'mailto:[email protected]',
        ))

    def test_phones(self):
        self.assertEqual(('1234',), self.reg.phones)

    def test_emails(self):
        self.assertEqual(('[email protected]',), self.reg.emails)

    def test_phone(self):
        self.assertEqual('1234', self.reg.phone)

    def test_email(self):
        self.assertEqual('[email protected]', self.reg.email)

    def test_to_partial_json(self):
        self.assertEqual(self.jobj_to, self.reg.to_partial_json())

    def test_from_json(self):
        from acme.messages import Registration
        self.assertEqual(self.reg, Registration.from_json(self.jobj_from))

    def test_from_json_hashable(self):
        from acme.messages import Registration
        hash(Registration.from_json(self.jobj_from))
开发者ID:gh0std4ncer,项目名称:letsencrypt,代码行数:56,代码来源:messages_test.py

示例3: setUp

    def setUp(self):
        key = jose.jwk.JWKRSA(key=KEY.public_key())
        contact = (
            'mailto:[email protected]',
            'tel:1234',
        )
        agreement = 'https://letsencrypt.org/terms'

        from acme.messages import Registration
        self.reg = Registration(key=key, contact=contact, agreement=agreement)
        self.reg_none = Registration()

        self.jobj_to = {
            'contact': contact,
            'agreement': agreement,
            'key': key,
        }
        self.jobj_from = self.jobj_to.copy()
        self.jobj_from['key'] = key.to_json()
开发者ID:J0WI,项目名称:lets-encrypt-preview,代码行数:19,代码来源:messages_test.py

示例4: test_from_json_hashable

 def test_from_json_hashable(self):
     from acme.messages import Registration
     hash(Registration.from_json(self.jobj_from))
开发者ID:g1franc,项目名称:lets-encrypt-preview,代码行数:3,代码来源:messages_test.py

示例5: test_from_json

 def test_from_json(self):
     from acme.messages import Registration
     self.assertEqual(self.reg, Registration.from_json(self.jobj_from))
开发者ID:g1franc,项目名称:lets-encrypt-preview,代码行数:3,代码来源:messages_test.py

示例6: RegistrationTest

class RegistrationTest(unittest.TestCase):
    """Tests for acme.messages.Registration."""

    def setUp(self):
        key = jose.jwk.JWKRSA(key=KEY.public_key())
        contact = (
            'mailto:[email protected]',
            'tel:1234',
        )
        agreement = 'https://letsencrypt.org/terms'

        from acme.messages import Registration
        self.reg = Registration(key=key, contact=contact, agreement=agreement)
        self.reg_none = Registration()

        self.jobj_to = {
            'contact': contact,
            'agreement': agreement,
            'key': key,
        }
        self.jobj_from = self.jobj_to.copy()
        self.jobj_from['key'] = key.to_json()

    def test_from_data(self):
        from acme.messages import Registration
        reg = Registration.from_data(phone='1234', email='[email protected]')
        self.assertEqual(reg.contact, (
            'tel:1234',
            'mailto:[email protected]',
        ))

    def test_new_registration_from_data_with_eab(self):
        from acme.messages import NewRegistration, ExternalAccountBinding, Directory
        key = jose.jwk.JWKRSA(key=KEY.public_key())
        kid = "kid-for-testing"
        hmac_key = "hmac-key-for-testing"
        directory = Directory({
            'newAccount': 'http://url/acme/new-account',
        })
        eab = ExternalAccountBinding.from_data(key, kid, hmac_key, directory)
        reg = NewRegistration.from_data(email='[email protected]', external_account_binding=eab)
        self.assertEqual(reg.contact, (
            'mailto:[email protected]',
        ))
        self.assertEqual(sorted(reg.external_account_binding.keys()),
                         sorted(['protected', 'payload', 'signature']))

    def test_phones(self):
        self.assertEqual(('1234',), self.reg.phones)

    def test_emails(self):
        self.assertEqual(('[email protected]',), self.reg.emails)

    def test_to_partial_json(self):
        self.assertEqual(self.jobj_to, self.reg.to_partial_json())

    def test_from_json(self):
        from acme.messages import Registration
        self.assertEqual(self.reg, Registration.from_json(self.jobj_from))

    def test_from_json_hashable(self):
        from acme.messages import Registration
        hash(Registration.from_json(self.jobj_from))
开发者ID:J0WI,项目名称:lets-encrypt-preview,代码行数:63,代码来源:messages_test.py


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