Add UT for set_zone on SUSE series

This commit is contained in:
Bo Maryniuk 2017-04-21 16:50:47 +02:00
parent 155a498b49
commit ce4c836a60

View File

@ -122,3 +122,18 @@ class TimezoneTestCase(TestCase):
assert timezone.set_zone(self.TEST_TZ) assert timezone.set_zone(self.TEST_TZ)
name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[0] name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[0]
assert args == ('/etc/sysconfig/clock', '^ZONE=.*', 'ZONE="UTC"') 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"')