OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the timezone Windows Registry plugin.""" | 3 """Tests for the timezone Windows Registry plugin.""" |
4 | 4 |
5 from __future__ import unicode_literals | 5 from __future__ import unicode_literals |
6 | 6 |
7 import unittest | 7 import unittest |
8 | 8 |
9 from dfdatetime import filetime as dfdatetime_filetime | 9 from dfdatetime import filetime as dfdatetime_filetime |
10 from dfwinreg import definitions as dfwinreg_definitions | 10 from dfwinreg import definitions as dfwinreg_definitions |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 registry_key.AddValue(registry_value) | 100 registry_key.AddValue(registry_value) |
101 | 101 |
102 value_data = 'W. Europe Standard Time'.encode('utf_16_le') | 102 value_data = 'W. Europe Standard Time'.encode('utf_16_le') |
103 registry_value = dfwinreg_fake.FakeWinRegistryValue( | 103 registry_value = dfwinreg_fake.FakeWinRegistryValue( |
104 'TimeZoneKeyName', data=value_data, | 104 'TimeZoneKeyName', data=value_data, |
105 data_type=dfwinreg_definitions.REG_SZ) | 105 data_type=dfwinreg_definitions.REG_SZ) |
106 registry_key.AddValue(registry_value) | 106 registry_key.AddValue(registry_value) |
107 | 107 |
108 return registry_key | 108 return registry_key |
109 | 109 |
| 110 def testFilters(self): |
| 111 """Tests the FILTERS class attribute.""" |
| 112 plugin = winreg_timezone.WinRegTimezonePlugin() |
| 113 |
| 114 key_path = ( |
| 115 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' |
| 116 'TimeZoneInformation') |
| 117 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 118 |
| 119 self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus') |
| 120 |
110 def testProcessMock(self): | 121 def testProcessMock(self): |
111 """Tests the Process function on created key.""" | 122 """Tests the Process function on created key.""" |
112 key_path = ( | 123 key_path = ( |
113 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' | 124 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' |
114 'TimeZoneInformation') | 125 'TimeZoneInformation') |
115 time_string = '2013-01-30 10:47:57' | 126 time_string = '2013-01-30 10:47:57' |
116 registry_key = self._CreateTestKey(key_path, time_string) | 127 registry_key = self._CreateTestKey(key_path, time_string) |
117 | 128 |
118 plugin = winreg_timezone.WinRegTimezonePlugin() | 129 plugin = winreg_timezone.WinRegTimezonePlugin() |
119 storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) | 130 storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 'StandardBias: 0 ' | 187 'StandardBias: 0 ' |
177 'StandardName: @tzres.dll,-112 ' | 188 'StandardName: @tzres.dll,-112 ' |
178 'TimeZoneKeyName: Eastern Standard Time').format(key_path) | 189 'TimeZoneKeyName: Eastern Standard Time').format(key_path) |
179 expected_short_message = '{0:s}...'.format(expected_message[:77]) | 190 expected_short_message = '{0:s}...'.format(expected_message[:77]) |
180 | 191 |
181 self._TestGetMessageStrings(event, expected_message, expected_short_message) | 192 self._TestGetMessageStrings(event, expected_message, expected_short_message) |
182 | 193 |
183 | 194 |
184 if __name__ == '__main__': | 195 if __name__ == '__main__': |
185 unittest.main() | 196 unittest.main() |
OLD | NEW |