summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2014-05-27 10:17:18 -0600
committerBen Howard <ben.howard@canonical.com>2014-05-27 10:17:18 -0600
commitf7fa9d2aa9abd81b8f8b79b95bdb1fc0c10b5fe9 (patch)
tree2ab1fb080a13f9f04d2d4de0372d435791a9e1d4 /tests/unittests
parent2f9b47be819e4aa90d0cfd940557b90cbd6912de (diff)
downloadvyos-cloud-init-f7fa9d2aa9abd81b8f8b79b95bdb1fc0c10b5fe9.tar.gz
vyos-cloud-init-f7fa9d2aa9abd81b8f8b79b95bdb1fc0c10b5fe9.zip
Enable vendordata for CloudSigma (LP: #1303986)
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_datasource/test_cloudsigma.py28
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)