summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_opennebula.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-03-27 10:03:27 -0400
committerScott Moser <smoser@ubuntu.com>2014-03-27 10:03:27 -0400
commit2ecefdf51cd93b593bea450b4d751021da91e748 (patch)
treeb9e7e851aa0daa1d7106d66e0f1642e04b4f46db /tests/unittests/test_datasource/test_opennebula.py
parent9486c1a1abacb9829e5ab172212d57c3735e35e0 (diff)
downloadvyos-cloud-init-2ecefdf51cd93b593bea450b4d751021da91e748.tar.gz
vyos-cloud-init-2ecefdf51cd93b593bea450b4d751021da91e748.zip
change 'default' encoding to be "None"
Instead of just trying to see if userdata decodes as the indication that it should be encoded, the user must explicitly set this. The "just try it" will fail in the case where the user had other use of user-data and wanted a blob of data to go through unrecognized by cloud-init. In cases where there can be mistake in automatic behavior, and some users may be relaying on old behavior, its best to just require explicit use.
Diffstat (limited to 'tests/unittests/test_datasource/test_opennebula.py')
-rw-r--r--tests/unittests/test_datasource/test_opennebula.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py
index 47e7acbc..ec6b752b 100644
--- a/tests/unittests/test_datasource/test_opennebula.py
+++ b/tests/unittests/test_datasource/test_opennebula.py
@@ -175,14 +175,15 @@ class TestOpenNebulaDataSource(MockerTestCase):
self.assertTrue('userdata' in results)
self.assertEqual(USER_DATA, results['userdata'])
- def test_user_data_default_encoding(self):
+ def test_user_data_encoding_required_for_decode(self):
+ b64userdata = b64encode(USER_DATA)
for k in ('USER_DATA', 'USERDATA'):
my_d = os.path.join(self.tmp, k)
- populate_context_dir(my_d, {k: b64encode(USER_DATA)})
+ populate_context_dir(my_d, {k: b64userdata})
results = ds.read_context_disk_dir(my_d)
self.assertTrue('userdata' in results)
- self.assertEqual(USER_DATA, results['userdata'])
+ self.assertEqual(b64userdata, results['userdata'])
def test_user_data_base64_encoding(self):
for k in ('USER_DATA', 'USERDATA'):