LEFT | RIGHT |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 return registry_key | 108 return registry_key |
109 | 109 |
110 def testFilters(self): | 110 def testFilters(self): |
111 """Tests the FILTERS class attribute.""" | 111 """Tests the FILTERS class attribute.""" |
112 plugin = winreg_timezone.WinRegTimezonePlugin() | 112 plugin = winreg_timezone.WinRegTimezonePlugin() |
113 | 113 |
114 key_path = ( | 114 key_path = ( |
115 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' | 115 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' |
116 'TimeZoneInformation') | 116 'TimeZoneInformation') |
117 registry_key = dfwinreg_fake.FakeWinRegistryKey( | 117 self._AssertFiltersOnKeyPath(plugin, key_path) |
118 'TimeZoneInformation', key_path=key_path) | |
119 | 118 |
120 result = self._CheckFiltersOnKeyPath(plugin, registry_key) | 119 self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus') |
121 self.assertTrue(result) | |
122 | |
123 key_path = 'HKEY_LOCAL_MACHINE\\Bogus' | |
124 registry_key = dfwinreg_fake.FakeWinRegistryKey('Bogus', key_path=key_path) | |
125 | |
126 result = self._CheckFiltersOnKeyPath(plugin, registry_key) | |
127 self.assertFalse(result) | |
128 | 120 |
129 def testProcessMock(self): | 121 def testProcessMock(self): |
130 """Tests the Process function on created key.""" | 122 """Tests the Process function on created key.""" |
131 key_path = ( | 123 key_path = ( |
132 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' | 124 'HKEY_LOCAL_MACHINE\\System\\ControlSet001\\Control\\' |
133 'TimeZoneInformation') | 125 'TimeZoneInformation') |
134 time_string = '2013-01-30 10:47:57' | 126 time_string = '2013-01-30 10:47:57' |
135 registry_key = self._CreateTestKey(key_path, time_string) | 127 registry_key = self._CreateTestKey(key_path, time_string) |
136 | 128 |
137 plugin = winreg_timezone.WinRegTimezonePlugin() | 129 plugin = winreg_timezone.WinRegTimezonePlugin() |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 'StandardBias: 0 ' | 187 'StandardBias: 0 ' |
196 'StandardName: @tzres.dll,-112 ' | 188 'StandardName: @tzres.dll,-112 ' |
197 'TimeZoneKeyName: Eastern Standard Time').format(key_path) | 189 'TimeZoneKeyName: Eastern Standard Time').format(key_path) |
198 expected_short_message = '{0:s}...'.format(expected_message[:77]) | 190 expected_short_message = '{0:s}...'.format(expected_message[:77]) |
199 | 191 |
200 self._TestGetMessageStrings(event, expected_message, expected_short_message) | 192 self._TestGetMessageStrings(event, expected_message, expected_short_message) |
201 | 193 |
202 | 194 |
203 if __name__ == '__main__': | 195 if __name__ == '__main__': |
204 unittest.main() | 196 unittest.main() |
LEFT | RIGHT |