summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler/test_handler_timezone.py
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2021-10-15 19:53:42 -0500
committerGitHub <noreply@github.com>2021-10-15 18:53:42 -0600
commita9501251aadf6d30192f7bd7debeabc9c3e29420 (patch)
tree209b109dd17834b35975c52d2d49a532bdd6ef13 /tests/unittests/test_handler/test_handler_timezone.py
parentb3e31ba228d32c318872fb68edda272f679e1004 (diff)
downloadvyos-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_timezone.py')
-rw-r--r--tests/unittests/test_handler/test_handler_timezone.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/tests/unittests/test_handler/test_handler_timezone.py b/tests/unittests/test_handler/test_handler_timezone.py
index 50c45363..77cdb0c2 100644
--- a/tests/unittests/test_handler/test_handler_timezone.py
+++ b/tests/unittests/test_handler/test_handler_timezone.py
@@ -6,21 +6,19 @@
from cloudinit.config import cc_timezone
-from cloudinit import cloud
-from cloudinit import distros
-from cloudinit import helpers
from cloudinit import util
-from cloudinit.sources import DataSourceNoCloud
-from cloudinit.tests import helpers as t_help
-
-from configobj import ConfigObj
import logging
import shutil
import tempfile
+from configobj import ConfigObj
from io import BytesIO
+from cloudinit.tests import helpers as t_help
+
+from tests.unittests.util import get_cloud
+
LOG = logging.getLogger(__name__)
@@ -29,25 +27,15 @@ class TestTimezone(t_help.FilesystemMockingTestCase):
super(TestTimezone, self).setUp()
self.new_root = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.new_root)
-
- def _get_cloud(self, distro):
self.patchUtils(self.new_root)
self.patchOS(self.new_root)
- paths = helpers.Paths({})
-
- cls = distros.fetch(distro)
- d = cls(distro, {}, paths)
- ds = DataSourceNoCloud.DataSourceNoCloud({}, d, paths)
- cc = cloud.Cloud(ds, paths, {}, d, None)
- return cc
-
def test_set_timezone_sles(self):
cfg = {
'timezone': 'Tatooine/Bestine',
}
- cc = self._get_cloud('sles')
+ cc = get_cloud('sles')
# Create a dummy timezone file
dummy_contents = '0123456789abcdefgh'