From 83a3fed0d38e44e64cec027f9fd2fcd5a894f96a Mon Sep 17 00:00:00 2001 From: kali Date: Tue, 4 Sep 2012 03:18:13 +0900 Subject: fix test_checks: do not mess with real home path! It is really dangerous to mess with expanduser paths in tests without deriving testcases from LeapTestCase. It'd be good to devise a way of checking for that :( --- src/leap/eip/checks.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/leap/eip/checks.py') diff --git a/src/leap/eip/checks.py b/src/leap/eip/checks.py index 51a7e219..1b7c2e1b 100644 --- a/src/leap/eip/checks.py +++ b/src/leap/eip/checks.py @@ -15,6 +15,7 @@ from leap.eip import config as eipconfig from leap.eip import constants as eipconstants from leap.eip import exceptions as eipexceptions from leap.eip import specs as eipspecs +from leap.util.fileutil import mkdir_p """ EIPConfigChecker @@ -33,7 +34,6 @@ reachable and testable as a whole. Other related checkers - not implemented yet -: * LeapNetworkChecker -* ProviderCertChecker """ @@ -131,9 +131,9 @@ class ProviderCertChecker(object): exists = lambda: self.is_certificate_exists() valid_pemfile = lambda: self.is_valid_pemfile() not_expired = lambda: self.is_cert_not_expired() - print 'exists?', exists - print 'valid', valid_pemfile - print 'not expired', not_expired + #print 'exists?', exists + #print 'valid', valid_pemfile + #print 'not expired', not_expired valid = exists() and valid_pemfile() and not_expired() if not valid: @@ -181,12 +181,13 @@ class ProviderCertChecker(object): def _get_client_cert_path(self): # MVS+ : get provider path + #import ipdb;ipdb.set_trace() return eipspecs.client_cert_path() - def is_cert_still_valid(self): - raise NotImplementedError - def write_cert(self, pemfile_content, to=None): + folder, filename = os.path.split(to) + if not os.path.isdir(folder): + mkdir_p(folder) with open(to, 'w') as cert_f: cert_f.write(pemfile_content) -- cgit v1.2.3