summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-02-07 16:46:32 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-02-07 16:46:32 -0800
commit7fb9f75e1bd8b8ef36398c7adeb8d18a4fe9745e (patch)
tree93176474f3c688c35912206aa5a9f3592b99cbc7 /tests/unittests
parent6e40098626531397a339d3a231d821b738e69175 (diff)
downloadvyos-cloud-init-7fb9f75e1bd8b8ef36398c7adeb8d18a4fe9745e.tar.gz
vyos-cloud-init-7fb9f75e1bd8b8ef36398c7adeb8d18a4fe9745e.zip
Add test for disabled dsmode
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_datasource/test_openstack.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py
index c8cc40db..3fcf8bc9 100644
--- a/tests/unittests/test_datasource/test_openstack.py
+++ b/tests/unittests/test_datasource/test_openstack.py
@@ -287,3 +287,26 @@ class TestOpenStackDataSource(test_helpers.TestCase):
found = ds_os.get_data()
self.assertFalse(found)
self.assertIsNone(ds_os.version)
+
+ @hp.activate
+ def test_disabled_datasource(self):
+ os_files = copy.deepcopy(OS_FILES)
+ os_meta = copy.deepcopy(OSTACK_META)
+ os_meta['meta'] = {
+ 'dsmode': 'disabled',
+ }
+ for k in list(os_files.keys()):
+ if k.endswith('meta_data.json'):
+ os_files[k] = json.dumps(os_meta)
+ _register_uris(self.VERSION, {}, {}, os_files)
+ ds_os = ds.DataSourceOpenStack(settings.CFG_BUILTIN,
+ None,
+ helpers.Paths({}))
+ ds_os.ds_cfg = {
+ 'max_wait': 0,
+ 'timeout': 0,
+ }
+ self.assertIsNone(ds_os.version)
+ found = ds_os.get_data()
+ self.assertFalse(found)
+ self.assertIsNone(ds_os.version)