class RecoveryContactResponseTest(unittest.TestCase):

    def setUp(self):
        from letsencrypt.acme.challenges import RecoveryContactResponse
        self.msg = RecoveryContactResponse(token='23029d88d9e123e')
        self.jmsg = {'type': 'recoveryContact', 'token': '23029d88d9e123e'}

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

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

    def test_from_json_hashable(self):
        from letsencrypt.acme.challenges import RecoveryContactResponse
        hash(RecoveryContactResponse.from_json(self.jmsg))

    def test_json_without_optionals(self):
        del self.jmsg['token']

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

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
class RecoveryContactResponseTest(unittest.TestCase):
    def setUp(self):
        from letsencrypt.acme.challenges import RecoveryContactResponse
        self.msg = RecoveryContactResponse(token='23029d88d9e123e')
        self.jmsg = {'type': 'recoveryContact', 'token': '23029d88d9e123e'}

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

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

    def test_from_json_hashable(self):
        from letsencrypt.acme.challenges import RecoveryContactResponse
        hash(RecoveryContactResponse.from_json(self.jmsg))

    def test_json_without_optionals(self):
        del self.jmsg['token']

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

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
    def test_json_without_optionals(self):
        del self.jmsg['token']

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

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
    def test_json_without_optionals(self):
        del self.jmsg['token']

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

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_json())
 def test_from_json_hashable(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     hash(RecoveryContactResponse.from_json(self.jmsg))
 def test_from_json(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     self.assertEqual(
         self.msg, RecoveryContactResponse.from_json(self.jmsg))
 def setUp(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     self.msg = RecoveryContactResponse(token='23029d88d9e123e')
     self.jmsg = {'type': 'recoveryContact', 'token': '23029d88d9e123e'}
 def test_from_json(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     self.assertEqual(self.msg,
                      RecoveryContactResponse.from_json(self.jmsg))
 def setUp(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     self.msg = RecoveryContactResponse(token='23029d88d9e123e')
     self.jmsg = {'type': 'recoveryContact', 'token': '23029d88d9e123e'}
 def test_from_json_hashable(self):
     from letsencrypt.acme.challenges import RecoveryContactResponse
     hash(RecoveryContactResponse.from_json(self.jmsg))