diff options
author | Johann Queuniet <jqueuniet@users.noreply.github.com> | 2020-09-18 18:02:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-18 14:02:15 -0400 |
commit | 6b5c306b537aafeded249fc82a3317fba8214508 (patch) | |
tree | dd84ba783caca4c5cc76fd8899ada25759a6d65b /tests/unittests/test_util.py | |
parent | 5fc34d81a002f6ca0706f5285ee15b919c3d8d2e (diff) | |
download | vyos-cloud-init-6b5c306b537aafeded249fc82a3317fba8214508.tar.gz vyos-cloud-init-6b5c306b537aafeded249fc82a3317fba8214508.zip |
Add vendor-data support to seedfrom parameter for NoCloud and OVF (#570)
Diffstat (limited to 'tests/unittests/test_util.py')
-rw-r--r-- | tests/unittests/test_util.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index fc557469..cca53123 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -735,13 +735,35 @@ class TestReadSeeded(helpers.TestCase): def test_unicode_not_messed_up(self): ud = b"userdatablob" + vd = b"vendordatablob" + helpers.populate_dir( + self.tmp, {'meta-data': "key1: val1", 'user-data': ud, + 'vendor-data': vd}) + sdir = self.tmp + os.path.sep + (found_md, found_ud, found_vd) = util.read_seeded(sdir) + + self.assertEqual(found_md, {'key1': 'val1'}) + self.assertEqual(found_ud, ud) + self.assertEqual(found_vd, vd) + + +class TestReadSeededWithoutVendorData(helpers.TestCase): + def setUp(self): + super(TestReadSeededWithoutVendorData, self).setUp() + self.tmp = tempfile.mkdtemp() + self.addCleanup(shutil.rmtree, self.tmp) + + def test_unicode_not_messed_up(self): + ud = b"userdatablob" + vd = None helpers.populate_dir( self.tmp, {'meta-data': "key1: val1", 'user-data': ud}) sdir = self.tmp + os.path.sep - (found_md, found_ud) = util.read_seeded(sdir) + (found_md, found_ud, found_vd) = util.read_seeded(sdir) self.assertEqual(found_md, {'key1': 'val1'}) self.assertEqual(found_ud, ud) + self.assertEqual(found_vd, vd) class TestEncode(helpers.TestCase): |