diff options
author | Scott Moser <smoser@ubuntu.com> | 2016-03-03 15:17:24 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2016-03-03 15:17:24 -0500 |
commit | 96f1742b36241cee152aa2cb5b4a5e1a267a4770 (patch) | |
tree | e1aa43915c5949104129e289b985d118e9a2f85b /tests/unittests/test_handler/test_handler_lxd.py | |
parent | 42d3efe69caeb2bb1ebdd67f1bae3e8f2134ff85 (diff) | |
download | vyos-cloud-init-96f1742b36241cee152aa2cb5b4a5e1a267a4770.tar.gz vyos-cloud-init-96f1742b36241cee152aa2cb5b4a5e1a267a4770.zip |
fix lxd module to not do anything unless config provided
Diffstat (limited to 'tests/unittests/test_handler/test_handler_lxd.py')
-rw-r--r-- | tests/unittests/test_handler/test_handler_lxd.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unittests/test_handler/test_handler_lxd.py b/tests/unittests/test_handler/test_handler_lxd.py index 65794a41..7ffa2a53 100644 --- a/tests/unittests/test_handler/test_handler_lxd.py +++ b/tests/unittests/test_handler/test_handler_lxd.py @@ -57,3 +57,19 @@ class TestLxd(t_help.TestCase): self.assertTrue(cc.distro.install_packages.called) install_pkg = cc.distro.install_packages.call_args_list[0][0][0] self.assertEquals(sorted(install_pkg), ['lxd', 'zfs']) + + @mock.patch("cloudinit.config.cc_lxd.util") + def test_no_init_does_nothing(self, mock_util): + cc = self._get_cloud('ubuntu') + cc.distro = mock.MagicMock() + cc_lxd.handle('cc_lxd', {'lxd': {}}, cc, LOG, []) + self.assertFalse(cc.distro.install_packages.called) + self.assertFalse(mock_util.subp.called) + + @mock.patch("cloudinit.config.cc_lxd.util") + def test_no_lxd_does_nothing(self, mock_util): + cc = self._get_cloud('ubuntu') + cc.distro = mock.MagicMock() + cc_lxd.handle('cc_lxd', {'package_update': True}, cc, LOG, []) + self.assertFalse(cc.distro.install_packages.called) + self.assertFalse(mock_util.subp.called) |