summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_data.py3
-rw-r--r--tests/unittests/test_runs/test_merge_run.py3
-rw-r--r--tests/unittests/test_runs/test_simple_run.py7
3 files changed, 8 insertions, 5 deletions
diff --git a/tests/unittests/test_data.py b/tests/unittests/test_data.py
index 3efe7adf..22cf8f28 100644
--- a/tests/unittests/test_data.py
+++ b/tests/unittests/test_data.py
@@ -27,6 +27,7 @@ from cloudinit.settings import (PER_INSTANCE)
from cloudinit import sources
from cloudinit import stages
from cloudinit import user_data as ud
+from cloudinit import safeyaml
from cloudinit import util
from cloudinit.tests import helpers
@@ -502,7 +503,7 @@ c: 4
data = [{'content': '#cloud-config\npassword: gocubs\n'},
{'content': '#cloud-config\nlocale: chicago\n'},
{'content': non_decodable}]
- message = b'#cloud-config-archive\n' + util.yaml_dumps(data).encode()
+ message = b'#cloud-config-archive\n' + safeyaml.dumps(data).encode()
self.reRoot()
ci = stages.Init()
diff --git a/tests/unittests/test_runs/test_merge_run.py b/tests/unittests/test_runs/test_merge_run.py
index d1ac4942..ff27a280 100644
--- a/tests/unittests/test_runs/test_merge_run.py
+++ b/tests/unittests/test_runs/test_merge_run.py
@@ -7,6 +7,7 @@ import tempfile
from cloudinit.tests import helpers
from cloudinit.settings import PER_INSTANCE
+from cloudinit import safeyaml
from cloudinit import stages
from cloudinit import util
@@ -26,7 +27,7 @@ class TestMergeRun(helpers.FilesystemMockingTestCase):
'system_info': {'paths': {'run_dir': new_root}}
}
ud = helpers.readResource('user_data.1.txt')
- cloud_cfg = util.yaml_dumps(cfg)
+ cloud_cfg = safeyaml.dumps(cfg)
util.ensure_dir(os.path.join(new_root, 'etc', 'cloud'))
util.write_file(os.path.join(new_root, 'etc',
'cloud', 'cloud.cfg'), cloud_cfg)
diff --git a/tests/unittests/test_runs/test_simple_run.py b/tests/unittests/test_runs/test_simple_run.py
index d67c422c..cb3aae60 100644
--- a/tests/unittests/test_runs/test_simple_run.py
+++ b/tests/unittests/test_runs/test_simple_run.py
@@ -5,6 +5,7 @@ import os
from cloudinit.settings import PER_INSTANCE
+from cloudinit import safeyaml
from cloudinit import stages
from cloudinit.tests import helpers
from cloudinit import util
@@ -34,7 +35,7 @@ class TestSimpleRun(helpers.FilesystemMockingTestCase):
],
'cloud_init_modules': ['write-files', 'spacewalk', 'runcmd'],
}
- cloud_cfg = util.yaml_dumps(self.cfg)
+ cloud_cfg = safeyaml.dumps(self.cfg)
util.ensure_dir(os.path.join(self.new_root, 'etc', 'cloud'))
util.write_file(os.path.join(self.new_root, 'etc',
'cloud', 'cloud.cfg'), cloud_cfg)
@@ -130,7 +131,7 @@ class TestSimpleRun(helpers.FilesystemMockingTestCase):
# re-write cloud.cfg with unverified_modules override
cfg = copy.deepcopy(self.cfg)
cfg['unverified_modules'] = ['spacewalk'] # Would have skipped
- cloud_cfg = util.yaml_dumps(cfg)
+ cloud_cfg = safeyaml.dumps(cfg)
util.ensure_dir(os.path.join(self.new_root, 'etc', 'cloud'))
util.write_file(os.path.join(self.new_root, 'etc',
'cloud', 'cloud.cfg'), cloud_cfg)
@@ -159,7 +160,7 @@ class TestSimpleRun(helpers.FilesystemMockingTestCase):
cfg = copy.deepcopy(self.cfg)
# Represent empty configuration in /etc/cloud/cloud.cfg
cfg['cloud_init_modules'] = None
- cloud_cfg = util.yaml_dumps(cfg)
+ cloud_cfg = safeyaml.dumps(cfg)
util.ensure_dir(os.path.join(self.new_root, 'etc', 'cloud'))
util.write_file(os.path.join(self.new_root, 'etc',
'cloud', 'cloud.cfg'), cloud_cfg)