summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-09-04 03:18:13 +0900
committerkali <kali@leap.se>2012-09-04 03:18:13 +0900
commit83a3fed0d38e44e64cec027f9fd2fcd5a894f96a (patch)
tree14890561d067ffa3d1444af7c77c1389853b3845 /src
parent8b3ad186e947ad962252c5d4b47a52ccb5514d98 (diff)
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 :(
Diffstat (limited to 'src')
-rw-r--r--src/leap/eip/checks.py15
-rw-r--r--src/leap/eip/tests/test_checks.py2
2 files changed, 9 insertions, 8 deletions
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)
diff --git a/src/leap/eip/tests/test_checks.py b/src/leap/eip/tests/test_checks.py
index 09fdaabf..0a87f573 100644
--- a/src/leap/eip/tests/test_checks.py
+++ b/src/leap/eip/tests/test_checks.py
@@ -228,7 +228,7 @@ class ProviderCertCheckerTest(BaseLeapTest):
checker.is_there_provider_ca())
-class ProviderCertCheckerHTTPSTests(BaseHTTPSServerTestCase):
+class ProviderCertCheckerHTTPSTests(BaseHTTPSServerTestCase, BaseLeapTest):
class request_handler(NoLogRequestHandler, BaseHTTPRequestHandler):
responses = {
'/': ['OK', ''],