summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler/test_handler_timezone.py
diff options
context:
space:
mode:
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'