diff options
author | James Falcon <james.falcon@canonical.com> | 2021-10-15 19:53:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 18:53:42 -0600 |
commit | a9501251aadf6d30192f7bd7debeabc9c3e29420 (patch) | |
tree | 209b109dd17834b35975c52d2d49a532bdd6ef13 /tests/unittests/test_handler/test_handler_mcollective.py | |
parent | b3e31ba228d32c318872fb68edda272f679e1004 (diff) | |
download | vyos-cloud-init-a9501251aadf6d30192f7bd7debeabc9c3e29420.tar.gz vyos-cloud-init-a9501251aadf6d30192f7bd7debeabc9c3e29420.zip |
testing: add get_cloud function (SC-461) (#1038)
Also added supporting distro/datasource classes and updated tests
that have a `get_cloud` call.
Diffstat (limited to 'tests/unittests/test_handler/test_handler_mcollective.py')
-rw-r--r-- | tests/unittests/test_handler/test_handler_mcollective.py | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/tests/unittests/test_handler/test_handler_mcollective.py b/tests/unittests/test_handler/test_handler_mcollective.py index 6891e15f..9cda6fbe 100644 --- a/tests/unittests/test_handler/test_handler_mcollective.py +++ b/tests/unittests/test_handler/test_handler_mcollective.py @@ -1,11 +1,4 @@ # This file is part of cloud-init. See LICENSE file for license information. - -from cloudinit import (cloud, distros, helpers, util) -from cloudinit.config import cc_mcollective -from cloudinit.sources import DataSourceNoCloud - -from cloudinit.tests import helpers as t_help - import configobj import logging import os @@ -13,6 +6,12 @@ import shutil import tempfile from io import BytesIO +from cloudinit import (util) +from cloudinit.config import cc_mcollective +from cloudinit.tests import helpers as t_help + +from tests.unittests.util import get_cloud + LOG = logging.getLogger(__name__) @@ -128,18 +127,10 @@ class TestConfig(t_help.FilesystemMockingTestCase): class TestHandler(t_help.TestCase): - def _get_cloud(self, distro): - cls = distros.fetch(distro) - paths = helpers.Paths({}) - d = cls(distro, {}, paths) - ds = DataSourceNoCloud.DataSourceNoCloud({}, d, paths) - cc = cloud.Cloud(ds, paths, {}, d, None) - return cc - @t_help.mock.patch("cloudinit.config.cc_mcollective.subp") @t_help.mock.patch("cloudinit.config.cc_mcollective.util") def test_mcollective_install(self, mock_util, mock_subp): - cc = self._get_cloud('ubuntu') + cc = get_cloud() cc.distro = t_help.mock.MagicMock() mock_util.load_file.return_value = b"" mycfg = {'mcollective': {'conf': {'loglevel': 'debug'}}} |