summaryrefslogtreecommitdiff
path: root/tests/unittests/test_data.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2014-01-17 08:21:48 -0700
committerBen Howard <ben.howard@canonical.com>2014-01-17 08:21:48 -0700
commit13d9bf99ee49e2b72cfe63ee9d90c231890e292a (patch)
treee3d9768e7645787b2db4558a38cd8350fc6062c4 /tests/unittests/test_data.py
parentb94c9790e055960fccf3b159d86db85ef37fb34f (diff)
downloadvyos-cloud-init-13d9bf99ee49e2b72cfe63ee9d90c231890e292a.tar.gz
vyos-cloud-init-13d9bf99ee49e2b72cfe63ee9d90c231890e292a.zip
Fix tsts
Diffstat (limited to 'tests/unittests/test_data.py')
-rw-r--r--tests/unittests/test_data.py45
1 files changed, 4 insertions, 41 deletions
diff --git a/tests/unittests/test_data.py b/tests/unittests/test_data.py
index 44395f06..a753debf 100644
--- a/tests/unittests/test_data.py
+++ b/tests/unittests/test_data.py
@@ -25,16 +25,11 @@ from tests.unittests import helpers
class FakeDataSource(sources.DataSource):
- def __init__(self, userdata=None, vendordata=None,
- consume_vendor=False):
+ def __init__(self, userdata=None, vendordata=None):
sources.DataSource.__init__(self, {}, None, None)
self.metadata = {'instance-id': INSTANCE_ID}
self.userdata_raw = userdata
self.vendordata_raw = vendordata
- self._consume_vendor = consume_vendor
-
- def consume_vendordata(self):
- return self._consume_vendor
# FIXME: these tests shouldn't be checking log output??
@@ -93,8 +88,7 @@ class TestConsumeUserData(helpers.FilesystemMockingTestCase):
#cloud-config-jsonp
[
{ "op": "add", "path": "/baz", "value": "qux" },
- { "op": "add", "path": "/bar", "value": "qux2" },
- { "op": "add", "path": "/vendor_data", "value": {"enabled": "true"}}
+ { "op": "add", "path": "/bar", "value": "qux2" }
]
'''
vendor_blob = '''
@@ -132,7 +126,8 @@ class TestConsumeUserData(helpers.FilesystemMockingTestCase):
#cloud-config-jsonp
[
{ "op": "add", "path": "/baz", "value": "qux" },
- { "op": "add", "path": "/bar", "value": "qux2" }
+ { "op": "add", "path": "/bar", "value": "qux2" },
+ { "op": "add", "path": "/vendor_data", "value": {"enabled": "false"}}
]
'''
vendor_blob = '''
@@ -199,38 +194,6 @@ c: d
self.assertEquals(1, len(cc))
self.assertEquals('c', cc['a'])
- def test_vendor_with_datasource_perm(self):
- vendor_blob = '''
-#cloud-config
-a: b
-name: vendor
-run:
- - x
- - y
-'''
-
- new_root = self.makeDir()
- self._patchIn(new_root)
- initer = stages.Init()
- initer.datasource = FakeDataSource('', vendordata=vendor_blob,
- consume_vendor=True)
- initer.read_cfg()
- initer.initialize()
- initer.fetch()
- _iid = initer.instancify()
- initer.update()
- initer.cloudify().run('consume_data',
- initer.consume_data,
- args=[PER_INSTANCE],
- freq=PER_INSTANCE)
- mods = stages.Modules(initer)
- (_which_ran, _failures) = mods.run_section('cloud_init_modules')
- cfg = mods.cfg
- self.assertEquals('b', cfg['a'])
- self.assertEquals('vendor', cfg['name'])
- self.assertIn('x', cfg['run'])
- self.assertIn('y', cfg['run'])
-
def test_vendor_user_yaml_cloud_config(self):
vendor_blob = '''
#cloud-config