Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
winreg.OpenKey.close = mock.MagicMock()
winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
winreg.EnumValue = mock.MagicMock(
return_value=('TimeZoneKeyName', 'Belarus Standard Time'))
winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
sys.modules['winreg'] = winreg
import tzlocal.win32
tz = tzlocal.win32.get_localzone()
self.assertEqual(tz.zone, 'Europe/Minsk')
tzlocal.win32.valuestodict = mock.Mock(
return_value={
'StandardName': 'Mocked Standard Time',
'Std': 'Mocked Standard Time',
})
tz = tzlocal.win32.reload_localzone()
self.assertEqual(tz.zone, 'America/Bahia')
winreg.OpenKey = mock.MagicMock()
winreg.OpenKey.close = mock.MagicMock()
winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
winreg.EnumValue = mock.MagicMock(
return_value=('TimeZoneKeyName','Belarus Standard Time'))
winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
sys.modules['winreg'] = winreg
import tzlocal.win32
tz = tzlocal.win32.get_localzone()
self.assertEqual(tz.zone, 'Europe/Minsk')
tzlocal.win32.valuestodict = mock.Mock(return_value={
'StandardName': 'Mocked Standard Time',
'Std': 'Mocked Standard Time',
})
tz = tzlocal.win32.reload_localzone()
self.assertEqual(tz.zone, 'America/Bahia')
winreg.OpenKey = mock.MagicMock()
winreg.OpenKey.close = mock.MagicMock()
winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
winreg.EnumValue = mock.MagicMock(
return_value=('TimeZoneKeyName','Belarus Standard Time'))
winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
sys.modules['winreg'] = winreg
import tzlocal.win32
tz = tzlocal.win32.get_localzone()
self.assertEqual(tz.zone, 'Europe/Minsk')
tzlocal.win32.valuestodict = mock.Mock(return_value={
'StandardName': 'Mocked Standard Time',
'Std': 'Mocked Standard Time',
})
tz = tzlocal.win32.reload_localzone()
self.assertEqual(tz.zone, 'America/Bahia')
winreg.OpenKey = mock.MagicMock()
winreg.OpenKey.close = mock.MagicMock()
winreg.QueryInfoKey = mock.MagicMock(return_value=(1, 1))
winreg.EnumValue = mock.MagicMock(
return_value=('TimeZoneKeyName','Belarus Standard Time'))
winreg.EnumKey = mock.Mock(return_value='Bahia Standard Time')
sys.modules['winreg'] = winreg
import tzlocal.win32
tz = tzlocal.win32.get_localzone()
self.assertEqual(tz.zone, 'Europe/Minsk')
tzlocal.win32.valuestodict = mock.Mock(return_value={
'StandardName': 'Mocked Standard Time',
'Std': 'Mocked Standard Time',
})
tz = tzlocal.win32.reload_localzone()
self.assertEqual(tz.zone, 'America/Bahia')