summaryrefslogtreecommitdiff
path: root/src/leap/base
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-27 23:21:43 +0900
committerkali <kali@leap.se>2012-08-27 23:31:39 +0900
commit4a46723219e5284bec21b9dccd6589a670babc63 (patch)
treeb2d435b0c7e616c91cbf92b185f097985aec041e /src/leap/base
parente896190d159342d9819f0ad6f11fe01deb8eb9e5 (diff)
add test_dump_default_eipconfig to eip.test_checks
plus a little bit of cleaning around (created constants file). added some notes about inminent deprecation *work in progress*
Diffstat (limited to 'src/leap/base')
-rw-r--r--src/leap/base/config.py3
-rw-r--r--src/leap/base/tests/test_config.py25
2 files changed, 9 insertions, 19 deletions
diff --git a/src/leap/base/config.py b/src/leap/base/config.py
index 4d7db018..93a89638 100644
--- a/src/leap/base/config.py
+++ b/src/leap/base/config.py
@@ -162,7 +162,7 @@ def get_groupname():
# json stuff
-# XXX merge with JSONConfig
+# XXX merge with JSONConfig / EIPChecks as appropiate.
def get_config_json(config_file=None):
"""
will replace get_config function be developing them
@@ -236,6 +236,7 @@ class Configuration(object):
except requests.ConnectionError as e:
if e.message == "[Errno 113] No route to host":
if not is_internet_up:
+ # this was meant to be a function invocation I guess...
self.error = "No valid internet connection found"
else:
self.error = "Provider server appears currently down."
diff --git a/src/leap/base/tests/test_config.py b/src/leap/base/tests/test_config.py
index 67be0e54..93de0782 100644
--- a/src/leap/base/tests/test_config.py
+++ b/src/leap/base/tests/test_config.py
@@ -10,6 +10,7 @@ import requests
from leap.base import config
from leap.base import constants
from leap.base import exceptions
+from leap.eip import constants as eipconstants
from leap.util.fileutil import mkdir_p
from leap.testing.basetest import BaseLeapTest
@@ -50,26 +51,13 @@ class ProviderDefinitionTestCase(ProviderTest):
def setUp(self):
# dump a sample eip file
# XXX Move to Use EIP Spec Instead!!!
- EIP_JSON = {
- "provider": "testprovider.org",
- "transport": "openvpn",
- "openvpn_protocol": "tcp",
- "openvpn_port": "80",
- "openvpn_ca_certificate": "~/.config/leap/testprovider.org/"
- "keys/ca/testprovider-ca-cert-"
- "2013-01-01.pem",
- "openvpn_client_certificate": "~/.config/leap/testprovider.org/"
- "keys/client/openvpn-2012-09-31.pem",
- "connect_on_login": True,
- "block_cleartext_traffic": True,
- "primary_gateway": "usa_west",
- "secondary_gateway": "france",
- "management_password": "oph7Que1othahwiech6J"
- }
+ # XXX tests to be moved to eip.checks and eip.providers
+ # XXX can use eipconfig.dump_default_eipconfig
+
path = os.path.join(self.home, '.config', 'leap')
mkdir_p(path)
with open(os.path.join(path, 'eip.json'), 'w') as fp:
- json.dump(EIP_JSON, fp)
+ json.dump(eipconstants.EIP_SAMPLE_JSON, fp)
def test_complete_file(self):
with mock.patch.object(requests, "get") as mock_method:
@@ -88,6 +76,7 @@ class ProviderDefinitionTestCase(ProviderTest):
u'serial': 1,
u'services': [u'eip'],
u'version': u'0.1.0'}
+ # XXX why init to localhost?
cf = config.Configuration("http://localhost/")
self.assertIn('default', cf.providers)
@@ -238,7 +227,7 @@ class ConfigHelperFunctions(BaseLeapTest):
"""
code to be written yet
"""
- pass
+ raise NotImplementedError
if __name__ == "__main__":