summaryrefslogtreecommitdiff
path: root/src/leap/eip/tests
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-24 01:01:06 +0900
committerkali <kali@leap.se>2012-08-24 01:01:06 +0900
commitc2955d9655e3e7ccb3c5fc9e7d00a0d493d48a40 (patch)
treeff21bf162a97b0cc448775d597b619226f191dfc /src/leap/eip/tests
parentbd154da54eb022d12d225a84cea1053f868eab56 (diff)
parentdc10833bedcdecf081a7c79678614c5521445164 (diff)
Merge branch 'get-definition.json' into providers-static
adjusted some loose ends to make tests pass again. this merge is still half-baked regarding functionality: I've left in place old Configuration class used by some tests antialias did on his branch. I plan to merge that functionality with the more recent JSONConfig and Spec classes. Conflicts: src/leap/base/configuration.py src/leap/eip/config.py src/leap/eip/tests/test_config.py
Diffstat (limited to 'src/leap/eip/tests')
-rw-r--r--src/leap/eip/tests/test_config.py124
1 files changed, 0 insertions, 124 deletions
diff --git a/src/leap/eip/tests/test_config.py b/src/leap/eip/tests/test_config.py
index 2b949a19..3c5a1cde 100644
--- a/src/leap/eip/tests/test_config.py
+++ b/src/leap/eip/tests/test_config.py
@@ -14,12 +14,6 @@ from leap.eip import config as eip_config
_system = platform.system()
-#
-# XXX we moved a lot of stuff from eip_config
-# to base_config.
-# We should move most of these tests too.
-#
-
class EIPConfigTest(BaseLeapTest):
@@ -35,19 +29,6 @@ class EIPConfigTest(BaseLeapTest):
# helpers
#
- def get_username(self):
- return base_config.get_username()
-
- def get_groupname(self):
- return base_config.get_groupname()
-
- def _missing_test_for_plat(self, do_raise=False):
- if do_raise:
- raise NotImplementedError(
- "This test is not implemented "
- "for the running platform: %s" %
- _system)
-
def touch_exec(self):
tfile = os.path.join(
self.tempfile,
@@ -87,102 +68,6 @@ class EIPConfigTest(BaseLeapTest):
username)
return args
- #
- # tests
- #
-
- # XXX fixme! /home/user should
- # be replaced for proper home lookup.
-
- @unittest.skipUnless(_system == "Linux", "linux only")
- def test_lin_get_config_file(self):
- """
- config file path where expected? (linux)
- """
- self.assertEqual(
- base_config.get_config_file(
- 'test', folder="foo/bar"),
- '/home/%s/.config/leap/foo/bar/test' %
- self.get_username())
-
- @unittest.skipUnless(_system == "Darwin", "mac only")
- def test_mac_get_config_file(self):
- """
- config file path where expected? (mac)
- """
- self._missing_test_for_plat(do_raise=True)
-
- @unittest.skipUnless(_system == "Windows", "win only")
- def test_win_get_config_file(self):
- """
- config file path where expected?
- """
- self._missing_test_for_plat(do_raise=True)
-
- #
- # XXX hey, I'm raising exceptions here
- # on purpose. just wanted to make sure
- # that the skip stuff is doing it right.
- # If you're working on win/macos tests,
- # feel free to remove tests that you see
- # are too redundant.
-
- @unittest.skipUnless(_system == "Linux", "linux only")
- def test_lin_get_config_dir(self):
- """
- nice config dir? (linux)
- """
- self.assertEqual(
- base_config.get_config_dir(),
- '/home/%s/.config/leap' %
- self.get_username())
-
- @unittest.skipUnless(_system == "Darwin", "mac only")
- def test_mac_get_config_dir(self):
- """
- nice config dir? (mac)
- """
- self._missing_test_for_plat(do_raise=True)
-
- @unittest.skipUnless(_system == "Windows", "win only")
- def test_win_get_config_dir(self):
- """
- nice config dir? (win)
- """
- self._missing_test_for_plat(do_raise=True)
-
- # provider paths
-
- @unittest.skipUnless(_system == "Linux", "linux only")
- def test_get_default_provider_path(self):
- """
- is default provider path ok?
- """
- #XXX bad home assumption
- self.assertEqual(
- base_config.get_default_provider_path(),
- '/home/%s/.config/leap/providers/default/' %
- self.get_username())
-
- # validate ip
-
- def test_validate_ip(self):
- """
- check our ip validation
- """
- base_config.validate_ip('3.3.3.3')
- with self.assertRaises(socket.error):
- base_config.validate_ip('255.255.255.256')
- with self.assertRaises(socket.error):
- base_config.validate_ip('foobar')
-
- @unittest.skip
- def test_validate_domain(self):
- """
- code to be written yet
- """
- pass
-
# build command string
# these tests are going to have to check
# many combinations. we should inject some
@@ -197,15 +82,6 @@ class EIPConfigTest(BaseLeapTest):
self.assertEqual(command, 'openvpn')
self.assertEqual(args, self.get_expected_openvpn_args())
- # json config
-
- def test_get_config_json(self):
- config_js = base_config.get_config_json()
- self.assertTrue(isinstance(config_js, dict))
- self.assertTrue('transport' in config_js)
- self.assertTrue('provider' in config_js)
- self.assertEqual(config_js['provider'], "testprovider.org")
-
if __name__ == "__main__":
unittest.main()