From 914a07aaf8ef52b2eaf88f1bf01fb6f72adcac5a Mon Sep 17 00:00:00 2001 From: kali Date: Sat, 15 Dec 2012 02:25:12 +0900 Subject: use gnutls to parse pemfiles --- src/leap/crypto/tests/test_certs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/leap/crypto/tests/test_certs.py (limited to 'src/leap/crypto/tests/test_certs.py') diff --git a/src/leap/crypto/tests/test_certs.py b/src/leap/crypto/tests/test_certs.py new file mode 100644 index 00000000..4d167c51 --- /dev/null +++ b/src/leap/crypto/tests/test_certs.py @@ -0,0 +1,11 @@ +import unittest + + +class CertTestCase(unittest.TestCase): + + def test_load_client_and_pkey(self): + self.fail('not implemented') + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From e98c3cc5fad75bea038dc67238e5ce85d701b1e1 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 20 Dec 2012 02:50:52 +0900 Subject: fix broken tests --- src/leap/crypto/tests/test_certs.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/leap/crypto/tests/test_certs.py') diff --git a/src/leap/crypto/tests/test_certs.py b/src/leap/crypto/tests/test_certs.py index 4d167c51..e476b630 100644 --- a/src/leap/crypto/tests/test_certs.py +++ b/src/leap/crypto/tests/test_certs.py @@ -1,10 +1,21 @@ import unittest +from leap.testing.https_server import where +from leap.crypto import certs + class CertTestCase(unittest.TestCase): - def test_load_client_and_pkey(self): - self.fail('not implemented') + def test_can_load_client_and_pkey(self): + with open(where('leaptestscert.pem')) as cf: + cs = cf.read() + with open(where('leaptestskey.pem')) as kf: + ks = kf.read() + certs.can_load_cert_and_pkey(cs + ks) + + with self.assertRaises(certs.BadCertError): + # screw header + certs.can_load_cert_and_pkey(cs.replace("BEGIN", "BEGINN") + ks) if __name__ == "__main__": -- cgit v1.2.3