summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-07-09 20:20:55 -0400
committerScott Moser <smoser@ubuntu.com>2013-07-09 20:20:55 -0400
commit950762bb008d25f529c71aae4c0b04f6b0134abb (patch)
tree17c4e6996df55786db7ac8b3b8c0aaf37f261a3b /tests
parent4368b264be42472c53bc3333587c7029373ad56a (diff)
downloadvyos-cloud-init-950762bb008d25f529c71aae4c0b04f6b0134abb.tar.gz
vyos-cloud-init-950762bb008d25f529c71aae4c0b04f6b0134abb.zip
fill out load_azure_ovf_pubkeys
now if there are pubkeys, the cfg['_pubkeys'] entry will have a list of dicts where each dict has 'fingerprint' and 'path' entries. The next thing to do is to block waiting for the <fingerprint>.crt files to appear in /var/lib/waagent.
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_azure.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 68f4bcca..be6fab70 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -34,11 +34,12 @@ def construct_valid_ovf_env(data=None, pubkeys=None, userdata=None):
if pubkeys:
content += "<SSH><PublicKeys>\n"
- for fp, path in pubkeys.items():
+ for fp, path in pubkeys:
content += " <PublicKey>"
content += ("<Fingerprint>%s</Fingerprint><Path>%s</Path>" %
(fp, path))
- content += " </PublicKey>"
+ content += "</PublicKey>\n"
+ content += "</PublicKeys></SSH>"
content += """
</LinuxProvisioningConfigurationSet>
</wa:ProvisioningSection>
@@ -191,6 +192,14 @@ class TestReadAzureOvf(MockerTestCase):
self.assertRaises(DataSourceAzure.NonAzureDataSource,
DataSourceAzure.read_azure_ovf, invalid_xml)
+ def test_load_with_pubkeys(self):
+ mypklist = [{'fingerprint': 'fp1', 'path': 'path1'}]
+ pubkeys = [(x['fingerprint'], x['path']) for x in mypklist]
+ content = construct_valid_ovf_env(pubkeys=pubkeys)
+ (md, ud, cfg) = DataSourceAzure.read_azure_ovf(content)
+ for mypk in mypklist:
+ self.assertIn(mypk, cfg['_pubkeys'])
+
def apply_patches(patches):
ret = []