diff options
author | kali <kali@leap.se> | 2012-08-30 04:37:30 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-08-30 04:37:30 +0900 |
commit | 5e77b77765154850fb708e6ea188fcf7ba99fdce (patch) | |
tree | ae81cd0287c5435414bd2b9fff3f18664a835489 /src/leap/base/tests/test_config.py | |
parent | d69976caa5070403f81799c79be974241cff7f70 (diff) |
add test for JSONLeapConfig metaclass
Diffstat (limited to 'src/leap/base/tests/test_config.py')
-rw-r--r-- | src/leap/base/tests/test_config.py | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/leap/base/tests/test_config.py b/src/leap/base/tests/test_config.py index ef897a23..40461b99 100644 --- a/src/leap/base/tests/test_config.py +++ b/src/leap/base/tests/test_config.py @@ -23,6 +23,38 @@ except ImportError: _system = platform.system() +class JSONLeapConfigTest(BaseLeapTest): + def setUp(self): + pass + + def tearDown(self): + pass + + def test_metaclass(self): + with self.assertRaises(exceptions.ImproperlyConfigured) as exc: + class DummyTestConfig(config.JSONLeapConfig): + __metaclass__ = config.MetaConfigWithSpec + exc.startswith("missing spec dict") + + class DummyTestConfig(config.JSONLeapConfig): + __metaclass__ = config.MetaConfigWithSpec + spec = {} + with self.assertRaises(exceptions.ImproperlyConfigured) as exc: + DummyTestConfig() + exc.startswith("missing slug") + + class DummyTestConfig(config.JSONLeapConfig): + __metaclass__ = config.MetaConfigWithSpec + spec = {} + slug = "foo" + DummyTestConfig() + +######################################3 +# +# provider fetch tests block +# + + class ProviderTest(BaseLeapTest): # override per test fixtures @@ -45,7 +77,7 @@ class BareHomeTestCase(ProviderTest): class ProviderDefinitionTestCase(ProviderTest): - # XXX See how to merge with test_providers + # XXX MOVE TO eip.test_checks # -- kali 2012-08-24 00:38 __name__ = "provider_config_tests" @@ -62,10 +94,6 @@ class ProviderDefinitionTestCase(ProviderTest): json.dump(eipconstants.EIP_SAMPLE_JSON, fp) -# -# provider fetch tests block -# - # these tests below should move to wherever # we put the fetcher for provider files and related stuff. # TODO: @@ -107,6 +135,7 @@ class ProviderFetchInvalidUrl(ProviderTest): # end provider fetch tests +########################################### class ConfigHelperFunctions(BaseLeapTest): |