def setUp(self):
        from letsencrypt.acme.messages import Defer
        self.msg = Defer(
            token='O7-s9MNq1siZHlgrMzi9_A', interval=60,
            message='Warming up the HSM')

        self.jmsg = {
            'type': 'defer',
            'token': 'O7-s9MNq1siZHlgrMzi9_A',
            'interval': 60,
            'message': 'Warming up the HSM',
        }
class DeferTest(unittest.TestCase):

    def setUp(self):
        from letsencrypt.acme.messages import Defer
        self.msg = Defer(
            token='O7-s9MNq1siZHlgrMzi9_A', interval=60,
            message='Warming up the HSM')

        self.jmsg = {
            'type': 'defer',
            'token': 'O7-s9MNq1siZHlgrMzi9_A',
            'interval': 60,
            'message': 'Warming up the HSM',
        }

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

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

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

        from letsencrypt.acme.messages import Defer
        msg = Defer.from_json(self.jmsg)

        self.assertTrue(msg.interval is None)
        self.assertTrue(msg.message is None)
        self.assertEqual(self.jmsg, msg.to_json())
class DeferTest(unittest.TestCase):

    def setUp(self):
        from letsencrypt.acme.messages import Defer
        self.msg = Defer(
            token='O7-s9MNq1siZHlgrMzi9_A', interval=60,
            message='Warming up the HSM')

        self.jmsg = {
            'type': 'defer',
            'token': 'O7-s9MNq1siZHlgrMzi9_A',
            'interval': 60,
            'message': 'Warming up the HSM',
        }

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

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

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

        from letsencrypt.acme.messages import Defer
        msg = Defer.from_json(self.jmsg)

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

        from letsencrypt.acme.messages import Defer
        msg = Defer.from_json(self.jmsg)

        self.assertTrue(msg.interval is None)
        self.assertTrue(msg.message is None)
        self.assertEqual(self.jmsg, msg.to_json())
    def test_json_without_optionals(self):
        del self.jmsg['interval']
        del self.jmsg['message']

        from letsencrypt.acme.messages import Defer
        msg = Defer.from_json(self.jmsg)

        self.assertTrue(msg.interval is None)
        self.assertTrue(msg.message is None)
        self.assertEqual(self.jmsg, msg.to_partial_json())
    def setUp(self):
        from letsencrypt.acme.messages import Defer
        self.msg = Defer(
            token='O7-s9MNq1siZHlgrMzi9_A', interval=60,
            message='Warming up the HSM')

        self.jmsg = {
            'type': 'defer',
            'token': 'O7-s9MNq1siZHlgrMzi9_A',
            'interval': 60,
            'message': 'Warming up the HSM',
        }
 def test_from_json(self):
     from letsencrypt.acme.messages import Defer
     self.assertEqual(Defer.from_json(self.jmsg), self.msg)
 def test_from_json(self):
     from letsencrypt.acme.messages import Defer
     self.assertEqual(Defer.from_json(self.jmsg), self.msg)