diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-05-30 14:33:02 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-05-30 14:33:02 -0400 |
commit | e0650257e1ef728304a0c7230c0a2d2710a8ac5f (patch) | |
tree | 0123a44aedc7007abb9d222e1d6f2006c88c89f5 /tests/unittests | |
parent | 910128e61aa3244e254d9c9c803436a5b9aef93c (diff) | |
parent | f7fa9d2aa9abd81b8f8b79b95bdb1fc0c10b5fe9 (diff) | |
download | vyos-cloud-init-e0650257e1ef728304a0c7230c0a2d2710a8ac5f.tar.gz vyos-cloud-init-e0650257e1ef728304a0c7230c0a2d2710a8ac5f.zip |
add vendordata support to cloudsigma datasource
LP: #1303986
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/test_datasource/test_cloudsigma.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_cloudsigma.py b/tests/unittests/test_datasource/test_cloudsigma.py index adbb4afb..a1342a86 100644 --- a/tests/unittests/test_datasource/test_cloudsigma.py +++ b/tests/unittests/test_datasource/test_cloudsigma.py @@ -20,7 +20,11 @@ SERVER_CONTEXT = { "smp": 1, "tags": ["much server", "very performance"], "uuid": "65b2fb23-8c03-4187-a3ba-8b7c919e8890", - "vnc_password": "9e84d6cb49e46379" + "vnc_password": "9e84d6cb49e46379", + "vendor_data": { + "location": "zrh", + "cloudinit": "#cloud-config\n\n...", + } } @@ -68,3 +72,25 @@ class DataSourceCloudSigmaTest(TestCase): self.datasource.get_data() self.assertEqual(self.datasource.userdata_raw, b'hi world\n') + + def test_vendor_data(self): + self.assertEqual(self.datasource.vendordata_raw, + SERVER_CONTEXT['vendor_data']['cloudinit']) + + def test_lack_of_vendor_data(self): + stripped_context = copy.deepcopy(SERVER_CONTEXT) + del stripped_context["vendor_data"] + self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "") + self.datasource.cepko = CepkoMock(stripped_context) + self.datasource.get_data() + + self.assertIsNone(self.datasource.vendordata_raw) + + def test_lack_of_cloudinit_key_in_vendor_data(self): + stripped_context = copy.deepcopy(SERVER_CONTEXT) + del stripped_context["vendor_data"]["cloudinit"] + self.datasource = DataSourceCloudSigma.DataSourceCloudSigma("", "", "") + self.datasource.cepko = CepkoMock(stripped_context) + self.datasource.get_data() + + self.assertIsNone(self.datasource.vendordata_raw) |