From 6ce22c7ebd293550473bfa5453a2f720dffad3e8 Mon Sep 17 00:00:00 2001 From: antialias Date: Tue, 21 Aug 2012 13:46:01 -0700 Subject: minor pep8 clean up. --- src/leap/eip/config.py | 8 ++++---- src/leap/eip/exceptions.py | 2 -- 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 a219fed..e0151e8 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 ac61f42..3719c60 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 6534723..5a0e2d9 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") - -- cgit v1.2.3