diff options
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/eip/config.py | 8 | ||||
-rw-r--r-- | src/leap/eip/exceptions.py | 2 | ||||
-rw-r--r-- | src/leap/eip/tests/tests_config.py | 7 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/leap/eip/config.py b/src/leap/eip/config.py index a219fedb..e0151e87 100644 --- a/src/leap/eip/config.py +++ b/src/leap/eip/config.py @@ -403,14 +403,14 @@ def check_vpn_keys(config): check_and_fix_urw_only(keyfile) except OSError: raise EIPInitBadKeyFilePermError - - + + def get_config_json(config_file=None): """ will replace get_config function be developing them in parralel for branch purposes. @param: configuration file - @type: file + @type: file @rparam: configuration turples @rtype: dictionary """ @@ -421,7 +421,7 @@ def get_config_json(config_file=None): if not os.path.isdir(dpath): mkdir_p(dpath) with open(fpath, 'wb') as configfile: - configfile.write() + configfile.flush() config_file = open(fpath) config = json.load(config_file) diff --git a/src/leap/eip/exceptions.py b/src/leap/eip/exceptions.py index ac61f42b..3719c605 100644 --- a/src/leap/eip/exceptions.py +++ b/src/leap/eip/exceptions.py @@ -61,5 +61,3 @@ class EIPInitNoKeyFileError(Exception): class EIPInitBadKeyFilePermError(Exception): pass - - diff --git a/src/leap/eip/tests/tests_config.py b/src/leap/eip/tests/tests_config.py index 6534723e..5a0e2d94 100644 --- a/src/leap/eip/tests/tests_config.py +++ b/src/leap/eip/tests/tests_config.py @@ -5,14 +5,15 @@ import unittest from leap.eip import config + class TestConfig(unittest.TestCase): """ Test configuration help functions. """ + def test_get_config_json(self): config_js = config.get_config_json() self.assertTrue(isinstance(config_js, dict)) - self.assertTrue(config_js.has_key('transport')) - self.assertTrue(config_js.has_key('provider')) + self.assertTrue('transport' in config_js) + self.assertTrue('provider' in config_js) self.assertEqual(config_js['provider'], "testprovider.org") - |