OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the Networks Windows Registry plugin.""" | 3 """Tests for the Networks 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 unmanaged_subkey.AddValue(registry_value) | 183 unmanaged_subkey.AddValue(registry_value) |
184 | 184 |
185 value_data = b'\x00\x00\x00\x08' | 185 value_data = b'\x00\x00\x00\x08' |
186 registry_value = dfwinreg_fake.FakeWinRegistryValue( | 186 registry_value = dfwinreg_fake.FakeWinRegistryValue( |
187 'Source', data=value_data, | 187 'Source', data=value_data, |
188 data_type=dfwinreg_definitions.REG_DWORD_BIG_ENDIAN) | 188 data_type=dfwinreg_definitions.REG_DWORD_BIG_ENDIAN) |
189 unmanaged_subkey.AddValue(registry_value) | 189 unmanaged_subkey.AddValue(registry_value) |
190 | 190 |
191 return registry_key | 191 return registry_key |
192 | 192 |
| 193 def testFilters(self): |
| 194 """Tests the FILTERS class attribute.""" |
| 195 plugin = networks.NetworksPlugin() |
| 196 |
| 197 key_path = ( |
| 198 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\' |
| 199 'NetworkList') |
| 200 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 201 |
| 202 self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus') |
| 203 |
193 def testProcess(self): | 204 def testProcess(self): |
194 """Tests the Process function on created key.""" | 205 """Tests the Process function on created key.""" |
195 key_path = ( | 206 key_path = ( |
196 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion') | 207 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion') |
197 time_string = '2013-01-30 10:47:57' | 208 time_string = '2013-01-30 10:47:57' |
198 registry_key = self._CreateTestKey(key_path, time_string) | 209 registry_key = self._CreateTestKey(key_path, time_string) |
199 | 210 |
200 plugin = networks.NetworksPlugin() | 211 plugin = networks.NetworksPlugin() |
201 storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) | 212 storage_writer = self._ParseKeyWithPlugin(registry_key, plugin) |
202 | 213 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 'SSID: My Awesome Wifi Hotspot ' | 245 'SSID: My Awesome Wifi Hotspot ' |
235 'Description: My Awesome Wifi Hotspot ' | 246 'Description: My Awesome Wifi Hotspot ' |
236 'Connection Type: Wireless') | 247 'Connection Type: Wireless') |
237 expected_short_message = '{0:s}...'.format(expected_message[:77]) | 248 expected_short_message = '{0:s}...'.format(expected_message[:77]) |
238 | 249 |
239 self._TestGetMessageStrings(event, expected_message, expected_short_message) | 250 self._TestGetMessageStrings(event, expected_message, expected_short_message) |
240 | 251 |
241 | 252 |
242 if __name__ == '__main__': | 253 if __name__ == '__main__': |
243 unittest.main() | 254 unittest.main() |
OLD | NEW |