import unittest
-import xmlrpclib
-from cert import *
+from sfa.trust.certificate import Certificate, Keypair
+from sfa.util.py23 import xmlrpc_client
class TestCert(unittest.TestCase):
def setUp(self):
# try something a bit more complicated, like an xmlrpc encoding of
# some parameters
cert = Certificate(subject="test")
- data = xmlrpclib.dumps((1, "foo", ["a", "b"], {"c": "d", "e": "f"}, True))
+ data = xmlrpc_client.dumps((1, "foo", ["a", "b"], {"c": "d", "e": "f"}, True))
cert.set_data(data)
self.assertEqual(cert.get_data(), data)
self.assert_(cert2.is_signed_by_cert(cert1))
self.assert_(cert3.is_signed_by_cert(cert2))
- self.assert_(cert3.verify_chain([cert_root]))
+ cert3.verify_chain([cert_root])
# now save the chain to a string and load it into a new certificate
str_chain = cert3.save_to_string(save_parents=True)
cert4 = Certificate(string = str_chain)
# verify the newly loaded chain still verifies
- self.assert_(cert4.verify_chain([cert_root]))
+ cert4.verify_chain([cert_root])
# verify the parentage
self.assertEqual(cert4.get_parent().get_subject(), "two")