def test_set_hwclock_gentoo(self): """ Test set hwclock on Gentoo :return: """ with patch.dict(timezone.__grains__, {"os_family": ["Gentoo"]}): with self.assertRaises(SaltInvocationError): timezone.set_hwclock("forty two") timezone.set_hwclock("UTC") name, args, kwargs = timezone.__salt__["file.sed"].mock_calls[0] assert args == ("/etc/conf.d/hwclock", "^clock=.*", 'clock="UTC"') timezone.set_hwclock("localtime") name, args, kwargs = timezone.__salt__["file.sed"].mock_calls[1] assert args == ("/etc/conf.d/hwclock", "^clock=.*", 'clock="local"')
def test_set_hwclock_gentoo(self): ''' Test set hwclock on Gentoo :return: ''' with patch.dict(timezone.__grains__, {'os_family': ['Gentoo']}): with self.assertRaises(SaltInvocationError): timezone.set_hwclock('forty two') timezone.set_hwclock('UTC') name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[0] assert args == ('/etc/conf.d/hwclock', '^clock=.*', 'clock="UTC"') timezone.set_hwclock('localtime') name, args, kwargs = timezone.__salt__['file.sed'].mock_calls[1] assert args == ('/etc/conf.d/hwclock', '^clock=.*', 'clock="local"')
def test_set_hwclock_slackware(self): """ Test set hwclock on Slackware :return: """ with patch.dict(timezone.__grains__, {"os_family": ["Slackware"]}): with self.assertRaises(SaltInvocationError): timezone.set_hwclock("forty two") timezone.set_hwclock("UTC") name, args, kwargs = timezone.__salt__["file.sed"].mock_calls[0] assert args == ("/etc/hardwareclock", "^(UTC|localtime)", "UTC") timezone.set_hwclock("localtime") name, args, kwargs = timezone.__salt__["file.sed"].mock_calls[1] assert args == ("/etc/hardwareclock", "^(UTC|localtime)", "localtime")