Add UT for Debian on get_hwclock

This commit is contained in:
Bo Maryniuk 2017-04-24 15:11:41 +02:00
parent d337c09357
commit c3cafed6d5

View File

@ -216,3 +216,18 @@ class TimezoneTestCase(TestCase):
name, args, kwarg = timezone.__salt__['cmd.run'].mock_calls[0]
assert args == (['tail', '-n', '1', '/etc/adjtime'],)
assert kwarg == {'python_shell': False}
@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_get_hwclock_debian(self):
'''
Test get hwclock Debian
:return:
'''
timezone.__grains__['os_family'] = ['Debian']
timezone.get_hwclock()
name, args, kwarg = timezone.__salt__['cmd.run'].mock_calls[0]
assert args == (['tail', '-n', '1', '/etc/adjtime'],)
assert kwarg == {'python_shell': False}