class SimpleHTTPTest(unittest.TestCase): def setUp(self): from acme.challenges import SimpleHTTP self.msg = SimpleHTTP( token=jose.decode_b64jose( 'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA')) self.jmsg = { 'type': 'simpleHttp', 'token': 'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ-PCt92wr-oA', } def test_to_partial_json(self): self.assertEqual(self.jmsg, self.msg.to_partial_json()) def test_from_json(self): from acme.challenges import SimpleHTTP self.assertEqual(self.msg, SimpleHTTP.from_json(self.jmsg)) def test_from_json_hashable(self): from acme.challenges import SimpleHTTP hash(SimpleHTTP.from_json(self.jmsg)) def test_good_token(self): self.assertTrue(self.msg.good_token) self.assertFalse( self.msg.update(token=b'..').good_token)
class SimpleHTTPTest(unittest.TestCase): def setUp(self): from acme.challenges import SimpleHTTP self.msg = SimpleHTTP( token='evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA') self.jmsg = { 'type': 'simpleHttp', 'token': 'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA', 'tls': True, } def test_no_tls(self): from acme.challenges import SimpleHTTP self.assertEqual( SimpleHTTP(token='tok', tls=False).to_json(), { 'tls': False, 'token': 'tok', 'type': 'simpleHttp', }) def test_to_partial_json(self): self.assertEqual(self.jmsg, self.msg.to_partial_json()) def test_from_json(self): from acme.challenges import SimpleHTTP self.assertEqual(self.msg, SimpleHTTP.from_json(self.jmsg)) def test_from_json_hashable(self): from acme.challenges import SimpleHTTP hash(SimpleHTTP.from_json(self.jmsg))
class SimpleHTTPTest(unittest.TestCase): def setUp(self): from acme.challenges import SimpleHTTP self.msg = SimpleHTTP( token='evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA') self.jmsg = { 'type': 'simpleHttp', 'token': 'evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA', 'tls': True, } def test_no_tls(self): from acme.challenges import SimpleHTTP self.assertEqual(SimpleHTTP(token='tok', tls=False).to_json(), { 'tls': False, 'token': 'tok', 'type': 'simpleHttp', }) def test_to_partial_json(self): self.assertEqual(self.jmsg, self.msg.to_partial_json()) def test_from_json(self): from acme.challenges import SimpleHTTP self.assertEqual(self.msg, SimpleHTTP.from_json(self.jmsg)) def test_from_json_hashable(self): from acme.challenges import SimpleHTTP hash(SimpleHTTP.from_json(self.jmsg))