def setUp(self):
     from letsencrypt.acme.challenges import RecoveryContact
     self.msg = RecoveryContact(
         activation_url='https://example.ca/sendrecovery/a5bd99383fb0',
         success_url='https://example.ca/confirmrecovery/bb1b9928932',
         contact='c********[email protected]')
     self.jmsg = {
         'type': 'recoveryContact',
         'activationURL': 'https://example.ca/sendrecovery/a5bd99383fb0',
         'successURL': 'https://example.ca/confirmrecovery/bb1b9928932',
         'contact': 'c********[email protected]',
     }
class RecoveryContactTest(unittest.TestCase):
    def setUp(self):
        from letsencrypt.acme.challenges import RecoveryContact
        self.msg = RecoveryContact(
            activation_url='https://example.ca/sendrecovery/a5bd99383fb0',
            success_url='https://example.ca/confirmrecovery/bb1b9928932',
            contact='c********[email protected]')
        self.jmsg = {
            'type': 'recoveryContact',
            'activationURL': 'https://example.ca/sendrecovery/a5bd99383fb0',
            'successURL': 'https://example.ca/confirmrecovery/bb1b9928932',
            'contact': 'c********[email protected]',
        }

    def test_to_json(self):
        self.assertEqual(self.jmsg, self.msg.to_json())

    def test_from_json(self):
        from letsencrypt.acme.challenges import RecoveryContact
        self.assertEqual(self.msg, RecoveryContact.from_json(self.jmsg))

    def test_json_without_optionals(self):
        del self.jmsg['activationURL']
        del self.jmsg['successURL']
        del self.jmsg['contact']

        from letsencrypt.acme.challenges import RecoveryContact
        msg = RecoveryContact.from_json(self.jmsg)

        self.assertTrue(msg.activation_url is None)
        self.assertTrue(msg.success_url is None)
        self.assertTrue(msg.contact is None)
        self.assertEqual(self.jmsg, msg.to_json())
Пример #3
0
class RecoveryContactTest(unittest.TestCase):

    def setUp(self):
        from letsencrypt.acme.challenges import RecoveryContact
        self.msg = RecoveryContact(
            activation_url='https://example.ca/sendrecovery/a5bd99383fb0',
            success_url='https://example.ca/confirmrecovery/bb1b9928932',
            contact='c********[email protected]')
        self.jmsg = {
            'type': 'recoveryContact',
            'activationURL' : 'https://example.ca/sendrecovery/a5bd99383fb0',
            'successURL' : 'https://example.ca/confirmrecovery/bb1b9928932',
            'contact' : 'c********[email protected]',
        }

    def test_to_json(self):
        self.assertEqual(self.jmsg, self.msg.to_json())

    def test_from_json(self):
        from letsencrypt.acme.challenges import RecoveryContact
        self.assertEqual(self.msg, RecoveryContact.from_json(self.jmsg))

    def test_json_without_optionals(self):
        del self.jmsg['activationURL']
        del self.jmsg['successURL']
        del self.jmsg['contact']

        from letsencrypt.acme.challenges import RecoveryContact
        msg = RecoveryContact.from_json(self.jmsg)

        self.assertTrue(msg.activation_url is None)
        self.assertTrue(msg.success_url is None)
        self.assertTrue(msg.contact is None)
        self.assertEqual(self.jmsg, msg.to_json())
    def test_json_without_optionals(self):
        del self.jmsg['activationURL']
        del self.jmsg['successURL']
        del self.jmsg['contact']

        from letsencrypt.acme.challenges import RecoveryContact
        msg = RecoveryContact.from_json(self.jmsg)

        self.assertTrue(msg.activation_url is None)
        self.assertTrue(msg.success_url is None)
        self.assertTrue(msg.contact is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
 def setUp(self):
     from letsencrypt.acme.challenges import RecoveryContact
     self.msg = RecoveryContact(
         activation_url='https://example.ca/sendrecovery/a5bd99383fb0',
         success_url='https://example.ca/confirmrecovery/bb1b9928932',
         contact='c********[email protected]')
     self.jmsg = {
         'type': 'recoveryContact',
         'activationURL' : 'https://example.ca/sendrecovery/a5bd99383fb0',
         'successURL' : 'https://example.ca/confirmrecovery/bb1b9928932',
         'contact' : 'c********[email protected]',
     }
    def test_json_without_optionals(self):
        del self.jmsg['activationURL']
        del self.jmsg['successURL']
        del self.jmsg['contact']

        from letsencrypt.acme.challenges import RecoveryContact
        msg = RecoveryContact.from_json(self.jmsg)

        self.assertTrue(msg.activation_url is None)
        self.assertTrue(msg.success_url is None)
        self.assertTrue(msg.contact is None)
        self.assertEqual(self.jmsg, msg.to_json())
 def test_from_json_hashable(self):
     from letsencrypt.acme.challenges import RecoveryContact
     hash(RecoveryContact.from_json(self.jmsg))
 def test_from_json(self):
     from letsencrypt.acme.challenges import RecoveryContact
     self.assertEqual(self.msg, RecoveryContact.from_json(self.jmsg))
 def test_from_json(self):
     from letsencrypt.acme.challenges import RecoveryContact
     self.assertEqual(self.msg, RecoveryContact.from_json(self.jmsg))
 def test_from_json_hashable(self):
     from letsencrypt.acme.challenges import RecoveryContact
     hash(RecoveryContact.from_json(self.jmsg))