summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/tests/test_eipconfig.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-08-06 11:45:51 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-08-06 17:13:56 -0300
commit9dd371d0e3e284145cbe164fb9da806cf5f8e0d9 (patch)
tree08b43afc7b13c02277ee0b830aae3fd3550516cf /src/leap/services/eip/tests/test_eipconfig.py
parent5cb5b9e1af04866000b332e4abbbbdbb052ba455 (diff)
Update/add tests to support multiple schema.
Diffstat (limited to 'src/leap/services/eip/tests/test_eipconfig.py')
-rw-r--r--src/leap/services/eip/tests/test_eipconfig.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/leap/services/eip/tests/test_eipconfig.py b/src/leap/services/eip/tests/test_eipconfig.py
index 8b746b78..87ce04c2 100644
--- a/src/leap/services/eip/tests/test_eipconfig.py
+++ b/src/leap/services/eip/tests/test_eipconfig.py
@@ -117,18 +117,21 @@ class EIPConfigTest(BaseLeapTest):
conf.write(json.dumps(data))
conf.close()
- def _get_eipconfig(self, fromfile=True, data=sample_config):
+ def _get_eipconfig(self, fromfile=True, data=sample_config, api_ver='1'):
"""
Helper that returns an EIPConfig object using the data parameter
or a sample data.
:param fromfile: sets if we should use a file or a string
- :fromfile type: bool
+ :type fromfile: bool
:param data: sets the data to be used to load in the EIPConfig object
- :data type: dict (valid json)
+ :type data: dict (valid json)
+ :param api_ver: the api_version schema to use.
+ :type api_ver: str
:rtype: EIPConfig
"""
config = EIPConfig()
+ config.set_api_version(api_ver)
loaded = False
if fromfile:
@@ -308,6 +311,14 @@ class EIPConfigTest(BaseLeapTest):
with self.assertRaises(AssertionError):
config.get_client_cert_path(provider_config)
+ def test_fails_without_api_set(self):
+ config = EIPConfig()
+ with self.assertRaises(AssertionError):
+ config.load('non-relevant-path')
+
+ def test_fails_with_api_without_schema(self):
+ with self.assertRaises(AssertionError):
+ self._get_eipconfig(api_ver='123')
if __name__ == "__main__":
unittest.main()