summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource/test_azure.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2013-08-20 09:58:30 -0600
committerBen Howard <ben.howard@canonical.com>2013-08-20 09:58:30 -0600
commit89d58c94d59c62dddea3f77b7a805c1afa2ca955 (patch)
tree6b7cd86a373706730f0ec11f06517fc2a003f7c9 /tests/unittests/test_datasource/test_azure.py
parente683ab2baa3e67614edcd409122bd1aec99737e0 (diff)
parentb2ee0966793f3a9c7d8e92ce1c13b9583a9a76e7 (diff)
downloadvyos-cloud-init-89d58c94d59c62dddea3f77b7a805c1afa2ca955.tar.gz
vyos-cloud-init-89d58c94d59c62dddea3f77b7a805c1afa2ca955.zip
Updated merge proposal with current tree
Diffstat (limited to 'tests/unittests/test_datasource/test_azure.py')
-rw-r--r--tests/unittests/test_datasource/test_azure.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 4cd3f213..1ca6a79d 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -2,6 +2,7 @@ from cloudinit import helpers
from cloudinit.sources import DataSourceAzure
from tests.unittests.helpers import populate_dir
+import crypt
import base64
from mocker import MockerTestCase
import os
@@ -207,11 +208,15 @@ class TestAzureDataSource(MockerTestCase):
self.assertTrue('default_user' in dsrc.cfg['system_info'])
defuser = dsrc.cfg['system_info']['default_user']
- # default user shoudl be updated for password and username
- # and should not be locked.
+ # default user should be updated username and should not be locked.
self.assertEqual(defuser['name'], odata['UserName'])
- self.assertEqual(defuser['password'], odata['UserPassword'])
self.assertFalse(defuser['lock_passwd'])
+ # passwd is crypt formated string $id$salt$encrypted
+ # encrypting plaintext with salt value of everything up to final '$'
+ # should equal that after the '$'
+ pos = defuser['passwd'].rfind("$") + 1
+ self.assertEqual(defuser['passwd'],
+ crypt.crypt(odata['UserPassword'], defuser['passwd'][0:pos]))
def test_userdata_found(self):
mydata = "FOOBAR"
@@ -249,7 +254,6 @@ class TestAzureDataSource(MockerTestCase):
def test_apply_bounce_call_1(self):
# hostname needs to get through to apply_hostname_bounce
- mydata = "FOOBAR"
odata = {'HostName': 'my-random-hostname'}
data = {'ovfcontent': construct_valid_ovf_env(data=odata)}