summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDouglas Jordan <dojordan@microsoft.com>2018-03-10 07:20:08 +0100
committerChad Smith <chad.smith@canonical.com>2018-03-10 07:20:08 +0100
commitf891df345afa57c0c7734e8f04cca9a3d5881778 (patch)
tree74b2ad14be3840a3eb640492b597e371a26cdc3b /tests
parentb7a790246e52520b47a467fe89b81199b9cf03f6 (diff)
downloadvyos-cloud-init-f891df345afa57c0c7734e8f04cca9a3d5881778.tar.gz
vyos-cloud-init-f891df345afa57c0c7734e8f04cca9a3d5881778.zip
This commit fixes get_hostname on the AzureDataSource.
LP: #1754495
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_azure.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 254e9876..da7da0ca 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -643,6 +643,21 @@ fdescfs /dev/fd fdescfs rw 0 0
expected_config['config'].append(blacklist_config)
self.assertEqual(netconfig, expected_config)
+ @mock.patch("cloudinit.sources.DataSourceAzure.util.subp")
+ def test_get_hostname_with_no_args(self, subp):
+ dsaz.get_hostname()
+ subp.assert_called_once_with(("hostname",), capture=True)
+
+ @mock.patch("cloudinit.sources.DataSourceAzure.util.subp")
+ def test_get_hostname_with_string_arg(self, subp):
+ dsaz.get_hostname(hostname_command="hostname")
+ subp.assert_called_once_with(("hostname",), capture=True)
+
+ @mock.patch("cloudinit.sources.DataSourceAzure.util.subp")
+ def test_get_hostname_with_iterable_arg(self, subp):
+ dsaz.get_hostname(hostname_command=("hostname",))
+ subp.assert_called_once_with(("hostname",), capture=True)
+
class TestAzureBounce(CiTestCase):