summaryrefslogtreecommitdiff
path: root/tests/unittests/test_pathprefix2dict.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-02-25 19:40:33 -0500
committerScott Moser <smoser@ubuntu.com>2015-02-25 19:40:33 -0500
commit8cd5d7b143f882d80d45b1c04bdde1949846d4f1 (patch)
tree066a65a504d1409f9caa5d1298e07caa337064e8 /tests/unittests/test_pathprefix2dict.py
parente2fea567772f3d178072607aee617c3792185db0 (diff)
downloadvyos-cloud-init-8cd5d7b143f882d80d45b1c04bdde1949846d4f1.tar.gz
vyos-cloud-init-8cd5d7b143f882d80d45b1c04bdde1949846d4f1.zip
move towards user-data being binary
UrlResponse: biggest change... make readurl return bytes, making user know what to do with it. util: add load_tfile_or_url for loading text file or url as read_file_or_url now returns bytes ec2_utils: all meta-data is text, remove non-obvious string translations DigitalOcean: adjust for ec2_utils DataSourceGCE, DataSourceMAAS: user-data is binary other fields are text. openstack.py: read paths without decoding to text. This is ok as paths other than user-data are json, and load_json will handle load_file still returns text, and that is what most things use.
Diffstat (limited to 'tests/unittests/test_pathprefix2dict.py')
-rw-r--r--tests/unittests/test_pathprefix2dict.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/unittests/test_pathprefix2dict.py b/tests/unittests/test_pathprefix2dict.py
index 7089bde6..38fd75b6 100644
--- a/tests/unittests/test_pathprefix2dict.py
+++ b/tests/unittests/test_pathprefix2dict.py
@@ -14,28 +14,28 @@ class TestPathPrefix2Dict(TestCase):
self.addCleanup(shutil.rmtree, self.tmp)
def test_required_only(self):
- dirdata = {'f1': 'f1content', 'f2': 'f2content'}
+ dirdata = {'f1': b'f1content', 'f2': b'f2content'}
populate_dir(self.tmp, dirdata)
ret = util.pathprefix2dict(self.tmp, required=['f1', 'f2'])
self.assertEqual(dirdata, ret)
def test_required_missing(self):
- dirdata = {'f1': 'f1content'}
+ dirdata = {'f1': b'f1content'}
populate_dir(self.tmp, dirdata)
kwargs = {'required': ['f1', 'f2']}
self.assertRaises(ValueError, util.pathprefix2dict, self.tmp, **kwargs)
def test_no_required_and_optional(self):
- dirdata = {'f1': 'f1c', 'f2': 'f2c'}
+ dirdata = {'f1': b'f1c', 'f2': b'f2c'}
populate_dir(self.tmp, dirdata)
ret = util.pathprefix2dict(self.tmp, required=None,
- optional=['f1', 'f2'])
+ optional=['f1', 'f2'])
self.assertEqual(dirdata, ret)
def test_required_and_optional(self):
- dirdata = {'f1': 'f1c', 'f2': 'f2c'}
+ dirdata = {'f1': b'f1c', 'f2': b'f2c'}
populate_dir(self.tmp, dirdata)
ret = util.pathprefix2dict(self.tmp, required=['f1'], optional=['f2'])