OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the Microsoft Office MRUs Windows Registry plugin.""" | 3 """Tests for the Microsoft Office MRUs 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 plaso.formatters import officemru as _ # pylint: disable=unused-import | 9 from plaso.formatters import officemru as _ # pylint: disable=unused-import |
10 from plaso.formatters import winreg # pylint: disable=unused-import | 10 from plaso.formatters import winreg # pylint: disable=unused-import |
11 from plaso.lib import definitions | 11 from plaso.lib import definitions |
12 from plaso.lib import timelib | 12 from plaso.lib import timelib |
13 from plaso.parsers.winreg_plugins import officemru | 13 from plaso.parsers.winreg_plugins import officemru |
14 | 14 |
15 from tests import test_lib as shared_test_lib | 15 from tests import test_lib as shared_test_lib |
16 from tests.parsers.winreg_plugins import test_lib | 16 from tests.parsers.winreg_plugins import test_lib |
17 | 17 |
18 | 18 |
19 class OfficeMRUPluginTest(test_lib.RegistryPluginTestCase): | 19 class OfficeMRUPluginTest(test_lib.RegistryPluginTestCase): |
20 """Tests for the Microsoft Office MRUs Windows Registry plugin.""" | 20 """Tests for the Microsoft Office MRUs Windows Registry plugin.""" |
21 | 21 |
| 22 def testFilters(self): |
| 23 """Tests the FILTERS class attribute.""" |
| 24 plugin = officemru.OfficeMRUPlugin() |
| 25 |
| 26 key_path = ( |
| 27 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 28 'Access\\File MRU') |
| 29 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 30 |
| 31 key_path = ( |
| 32 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 33 'Access\\Place MRU') |
| 34 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 35 |
| 36 key_path = ( |
| 37 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 38 'Excel\\File MRU') |
| 39 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 40 |
| 41 key_path = ( |
| 42 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 43 'Excel\\Place MRU') |
| 44 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 45 |
| 46 key_path = ( |
| 47 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 48 'PowerPoint\\File MRU') |
| 49 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 50 |
| 51 key_path = ( |
| 52 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 53 'PowerPoint\\Place MRU') |
| 54 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 55 |
| 56 key_path = ( |
| 57 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 58 'Word\\File MRU') |
| 59 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 60 |
| 61 key_path = ( |
| 62 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\' |
| 63 'Word\\Place MRU') |
| 64 self._AssertFiltersOnKeyPath(plugin, key_path) |
| 65 |
| 66 self._AssertNotFiltersOnKeyPath(plugin, 'HKEY_LOCAL_MACHINE\\Bogus') |
| 67 |
22 @shared_test_lib.skipUnlessHasTestFile(['NTUSER-WIN7.DAT']) | 68 @shared_test_lib.skipUnlessHasTestFile(['NTUSER-WIN7.DAT']) |
23 def testProcess(self): | 69 def testProcess(self): |
24 """Tests the Process function.""" | 70 """Tests the Process function.""" |
25 test_file_entry = self._GetTestFileEntry(['NTUSER-WIN7.DAT']) | 71 test_file_entry = self._GetTestFileEntry(['NTUSER-WIN7.DAT']) |
26 key_path = ( | 72 key_path = ( |
27 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Word\\' | 73 'HKEY_CURRENT_USER\\Software\\Microsoft\\Office\\14.0\\Word\\' |
28 'File MRU') | 74 'File MRU') |
29 | 75 |
30 win_registry = self._GetWinRegistryFromFileEntry(test_file_entry) | 76 win_registry = self._GetWinRegistryFromFileEntry(test_file_entry) |
31 registry_key = win_registry.GetKeyByPath(key_path) | 77 registry_key = win_registry.GetKeyByPath(key_path) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 135 |
90 expected_message = '[{0:s}] Value: {1:s}'.format( | 136 expected_message = '[{0:s}] Value: {1:s}'.format( |
91 key_path, expected_value_string) | 137 key_path, expected_value_string) |
92 expected_short_message = '{0:s}...'.format(expected_value_string[:77]) | 138 expected_short_message = '{0:s}...'.format(expected_value_string[:77]) |
93 | 139 |
94 self._TestGetMessageStrings(event, expected_message, expected_short_message) | 140 self._TestGetMessageStrings(event, expected_message, expected_short_message) |
95 | 141 |
96 | 142 |
97 if __name__ == '__main__': | 143 if __name__ == '__main__': |
98 unittest.main() | 144 unittest.main() |
OLD | NEW |