summaryrefslogtreecommitdiff
path: root/tests/unittests/test_handler/test_handler_timezone.py
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2022-04-07 20:24:57 +0300
committerGitHub <noreply@github.com>2022-04-07 20:24:57 +0300
commit45c1d42e15f4a5fe5e176e1516b2da9d21e7837a (patch)
tree0535c3cf76b60dbf585416b4490c5bd9c9c99359 /tests/unittests/test_handler/test_handler_timezone.py
parent96226f37cdbdaef2fbc51de7b9ca75b61a16792b (diff)
parentaa60d48c2711cdcd9f88a4e5c77379adb0408231 (diff)
downloadvyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.tar.gz
vyos-cloud-init-45c1d42e15f4a5fe5e176e1516b2da9d21e7837a.zip
Merge pull request #52 from vyos/current
T2117: Backport Cloud-init 22.1 with our changes to VyOS 1.3
Diffstat (limited to 'tests/unittests/test_handler/test_handler_timezone.py')
-rw-r--r--tests/unittests/test_handler/test_handler_timezone.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/unittests/test_handler/test_handler_timezone.py b/tests/unittests/test_handler/test_handler_timezone.py
deleted file mode 100644
index 50c45363..00000000
--- a/tests/unittests/test_handler/test_handler_timezone.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
-#
-# Author: Juerg Haefliger <juerg.haefliger@hp.com>
-#
-# This file is part of cloud-init. See LICENSE file for license information.
-
-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 io import BytesIO
-
-LOG = logging.getLogger(__name__)
-
-
-class TestTimezone(t_help.FilesystemMockingTestCase):
- def setUp(self):
- 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')
-
- # Create a dummy timezone file
- dummy_contents = '0123456789abcdefgh'
- util.write_file('/usr/share/zoneinfo/%s' % cfg['timezone'],
- dummy_contents)
-
- cc_timezone.handle('cc_timezone', cfg, cc, LOG, [])
-
- contents = util.load_file('/etc/sysconfig/clock', decode=False)
- n_cfg = ConfigObj(BytesIO(contents))
- self.assertEqual({'TIMEZONE': cfg['timezone']}, dict(n_cfg))
-
- contents = util.load_file('/etc/localtime')
- self.assertEqual(dummy_contents, contents.strip())
-
-# vi: ts=4 expandtab