From ce4c836a601c6086c42ad54bccdf6b5eb7a06ca1 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Fri, 21 Apr 2017 16:50:47 +0200 Subject: [PATCH] Add UT for set_zone on SUSE series --- tests/unit/modules/timezone_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/modules/timezone_test.py b/tests/unit/modules/timezone_test.py index fbcbfc4269..d6057880f4 100644 --- a/tests/unit/modules/timezone_test.py +++ b/tests/unit/modules/timezone_test.py @@ -122,3 +122,18 @@ class TimezoneTestCase(TestCase): assert timezone.set_zone(self.TEST_TZ) name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[0] assert args == ('/etc/sysconfig/clock', '^ZONE=.*', 'ZONE="UTC"') + + @patch('salt.utils.which', MagicMock(return_value=False)) + @patch('os.path.exists', MagicMock(return_value=True)) + @patch('os.unlink', MagicMock()) + @patch('os.symlink', MagicMock()) + def test_set_zone_suse(self): + ''' + Test zone set on SUSE series + :return: + ''' + timezone.__grains__['os_family'] = ['SUSE'] + timezone.__salt__ + assert timezone.set_zone(self.TEST_TZ) + name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[0] + assert args == ('/etc/sysconfig/clock', '^TIMEZONE=.*', 'TIMEZONE="UTC"')