示例#1
0
 def test_from_data(self):
     from acme.messages import Registration
     reg = Registration.from_data(phone='1234', email='*****@*****.**')
     self.assertEqual(reg.contact, (
         'tel:1234',
         'mailto:[email protected]',
     ))
 def register_account(
     cls,
     email: str,
     directory_url: str = "https://acme-v02.api.letsencrypt.org/directory",
 ):
     """
     create a new acme account
     :param email: the email address that should be used for the account
     :param directory_url: the url of the acme directory that should be used
     :return: a new ACME client instance
     """
     keypair = cls._generate_keypair()
     client_network = ClientNetwork(keypair)
     directory = cls._get_directory(directory_url)
     registration = Registration.from_data(email=email,
                                           terms_of_service_agreed=True)
     client = ClientV2(directory, client_network)
     result = client.new_account(registration)
     return ACMEService(client)