def setUp(self):
     from acme.challenges import RecoveryTokenResponse
     self.msg = RecoveryTokenResponse(token='23029d88d9e123e')
     self.jmsg = {
         'resource': 'challenge',
         'type': 'recoveryToken',
         'token': '23029d88d9e123e'
     }
示例#2
0
class RecoveryTokenResponseTest(unittest.TestCase):

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

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

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

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

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

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

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
class RecoveryTokenResponseTest(unittest.TestCase):
    def setUp(self):
        from acme.challenges import RecoveryTokenResponse
        self.msg = RecoveryTokenResponse(token='23029d88d9e123e')
        self.jmsg = {
            'resource': 'challenge',
            'type': 'recoveryToken',
            'token': '23029d88d9e123e'
        }

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

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

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

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

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

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

        from acme.challenges import RecoveryTokenResponse
        msg = RecoveryTokenResponse.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 acme.challenges import RecoveryTokenResponse
        msg = RecoveryTokenResponse.from_json(self.jmsg)

        self.assertTrue(msg.token is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
示例#6
0
 def setUp(self):
     from acme.challenges import RecoveryTokenResponse
     self.msg = RecoveryTokenResponse(token='23029d88d9e123e')
     self.jmsg = {
         'resource': 'challenge',
         'type': 'recoveryToken',
         'token': '23029d88d9e123e'
     }
示例#7
0
 def test_from_json_hashable(self):
     from acme.challenges import RecoveryTokenResponse
     hash(RecoveryTokenResponse.from_json(self.jmsg))
示例#8
0
 def test_from_json(self):
     from acme.challenges import RecoveryTokenResponse
     self.assertEqual(
         self.msg, RecoveryTokenResponse.from_json(self.jmsg))
 def test_from_json_hashable(self):
     from acme.challenges import RecoveryTokenResponse
     hash(RecoveryTokenResponse.from_json(self.jmsg))
 def test_from_json(self):
     from acme.challenges import RecoveryTokenResponse
     self.assertEqual(self.msg, RecoveryTokenResponse.from_json(self.jmsg))