Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(347)

Unified Diff: tests/preprocessors/windows.py

Issue 150170043: [plaso] Made preprocessing artifact driven #155 (Closed)
Patch Set: Changes after review Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« plaso/preprocessors/windows.py ('K') | « tests/preprocessors/test_lib.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/preprocessors/windows.py
diff --git a/tests/preprocessors/windows.py b/tests/preprocessors/windows.py
index 926ba64d6d7b284d4443157c32b1d369cc46edce..1fc80475c30e91ec618c3df38f13959c0b9b3154 100644
--- a/tests/preprocessors/windows.py
+++ b/tests/preprocessors/windows.py
@@ -14,39 +14,43 @@ from tests import test_lib as shared_test_lib
from tests.preprocessors import test_lib
-class WindowsCodepagePreprocessPluginTest(test_lib.PreprocessPluginTestCase):
- """Tests for the Windows codepage preprocess plug-in object."""
+class WindowsCodepagePlugin(test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the Windows codepage plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SYSTEM'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsCodepagePreprocessPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSystem(plugin)
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
+ plugin = windows.WindowsCodepagePlugin()
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSystem(
+ plugin)
self.assertEqual(knowledge_base.codepage, u'cp1252')
-class WindowsHostnamePreprocessPluginTest(test_lib.PreprocessPluginTestCase):
- """Tests for the Windows hostname preprocess plug-in object."""
+class WindowsHostnamePluginTest(test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the Windows hostname plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SYSTEM'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsHostnamePreprocessPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSystem(plugin)
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
+ plugin = windows.WindowsHostnamePlugin()
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSystem(
+ plugin)
self.assertEqual(knowledge_base.hostname, u'WKS-WIN732BITA')
-class WindowsProgramFilesEnvironmentVariableTest(
- test_lib.PreprocessPluginTestCase):
- """Tests for the %ProgramFiles% environment variable plug-in."""
+class WindowsProgramFilesEnvironmentVariablePluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the %ProgramFiles% environment variable plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SOFTWARE'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsProgramFilesEnvironmentVariable()
- knowledge_base = self._RunWindowsRegistryPluginOnSoftware(plugin)
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
+ plugin = (
+ windows.WindowsProgramFilesEnvironmentVariablePlugin())
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSoftware(
+ plugin)
environment_variable = knowledge_base.GetEnvironmentVariable(
u'ProgramFiles')
@@ -54,15 +58,17 @@ class WindowsProgramFilesEnvironmentVariableTest(
self.assertEqual(environment_variable.value, u'C:\\Program Files')
-class WindowsProgramFilesX86EnvironmentVariableTest(
- test_lib.PreprocessPluginTestCase):
- """Tests for the %ProgramFilesX86% environment variable plug-in."""
+class WindowsProgramFilesX86EnvironmentVariablePluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the %ProgramFilesX86% environment variable plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SOFTWARE'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsProgramFilesX86EnvironmentVariable()
- knowledge_base = self._RunWindowsRegistryPluginOnSoftware(plugin)
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
+ plugin = (
+ windows.WindowsProgramFilesX86EnvironmentVariablePlugin())
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSoftware(
+ plugin)
environment_variable = knowledge_base.GetEnvironmentVariable(
u'ProgramFilesX86')
@@ -71,14 +77,14 @@ class WindowsProgramFilesX86EnvironmentVariableTest(
self.assertIsNone(environment_variable)
-class WindowsSystemRootEnvironmentVariableTest(
- test_lib.PreprocessPluginTestCase):
- """Tests for the %SystemRoot% environment variable plug-in."""
+class WindowsSystemRootEnvironmentVariablePluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the %SystemRoot% environment variable plugin."""
_FILE_DATA = b'regf'
- def testRun(self):
- """Tests the Run function."""
+ def testParsePathSpecification(self):
+ """Tests the _ParsePathSpecification function."""
file_system_builder = fake_file_system_builder.FakeFileSystemBuilder()
file_system_builder.AddFile(
u'/Windows/System32/config/SYSTEM', self._FILE_DATA)
@@ -86,8 +92,9 @@ class WindowsSystemRootEnvironmentVariableTest(
mount_point = path_spec_factory.Factory.NewPathSpec(
dfvfs_definitions.TYPE_INDICATOR_FAKE, location=u'/')
- plugin = windows.WindowsSystemRootEnvironmentVariable()
- knowledge_base = self._RunFileSystemPlugin(
+ plugin = (
+ windows.WindowsSystemRootEnvironmentVariablePlugin())
+ knowledge_base = self._RunPreprocessorPluginOnFileSystem(
file_system_builder.file_system, mount_point, plugin)
environment_variable = knowledge_base.GetEnvironmentVariable(u'SystemRoot')
@@ -95,55 +102,61 @@ class WindowsSystemRootEnvironmentVariableTest(
self.assertEqual(environment_variable.value, u'\\Windows')
-class WindowsSystemProductPluginTest(test_lib.PreprocessPluginTestCase):
- """Tests for the plugin to determine Windows system version information."""
+class WindowsSystemProductPluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the system product information plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SOFTWARE'])
- def testRun(self):
- """Tests the Run function."""
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
plugin = windows.WindowsSystemProductPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSoftware(plugin)
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSoftware(
+ plugin)
osversion = knowledge_base.GetValue(u'operating_system_product')
self.assertEqual(osversion, u'Windows 7 Ultimate')
-class WindowsSystemVersionPluginTest(test_lib.PreprocessPluginTestCase):
- """Tests for the plugin to determine Windows system version information."""
+class WindowsSystemVersionPluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the system version information plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SOFTWARE'])
- def testRun(self):
- """Tests the Run function."""
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
plugin = windows.WindowsSystemVersionPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSoftware(plugin)
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSoftware(
+ plugin)
osversion = knowledge_base.GetValue(u'operating_system_version')
self.assertEqual(osversion, u'6.1')
-class WindowsTimeZonePreprocessPluginTest(test_lib.PreprocessPluginTestCase):
- """Tests for the Windows timezone preprocess plug-in object."""
+class WindowsTimeZonePluginTest(test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the time zone plugin."""
@shared_test_lib.skipUnlessHasTestFile([u'SYSTEM'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsTimeZonePreprocessPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSystem(plugin)
+ def testParseValueData(self):
+ """Tests the _ParseValueData function."""
+ plugin = windows.WindowsTimeZonePlugin()
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSystem(
+ plugin)
self.assertEqual(knowledge_base.timezone.zone, u'EST5EDT')
-class WindowsUserAccountsPreprocessPluginTest(
- test_lib.PreprocessPluginTestCase):
- """Tests for the Windows username preprocess plug-in object."""
+class WindowsUserAccountsPluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the Windows user accounts artifacts mapping."""
# pylint: disable=protected-access
@shared_test_lib.skipUnlessHasTestFile([u'SOFTWARE'])
- def testRun(self):
- """Tests the Run function."""
- plugin = windows.WindowsUserAccountsPreprocessPlugin()
- knowledge_base = self._RunWindowsRegistryPluginOnSoftware(plugin)
+ def testParseKey(self):
+ """Tests the _ParseKey function."""
+ plugin = windows.WindowsUserAccountsPlugin()
+ knowledge_base = self._RunPreprocessorPluginOnWindowsRegistryValueSoftware(
+ plugin)
users = sorted(
knowledge_base.user_accounts,
@@ -159,5 +172,30 @@ class WindowsUserAccountsPreprocessPluginTest(
self.assertEqual(user_account.user_directory, u'C:\\Users\\rsydow')
+class WindowsWinDirEnvironmentVariablePluginTest(
+ test_lib.ArtifactPreprocessorPluginTestCase):
+ """Tests for the %WinDir% environment variable plugin."""
+
+ _FILE_DATA = b'regf'
+
+ def testParsePathSpecification(self):
+ """Tests the _ParsePathSpecification function."""
+ file_system_builder = fake_file_system_builder.FakeFileSystemBuilder()
+ file_system_builder.AddFile(
+ u'/Windows/System32/config/SYSTEM', self._FILE_DATA)
+
+ mount_point = path_spec_factory.Factory.NewPathSpec(
+ dfvfs_definitions.TYPE_INDICATOR_FAKE, location=u'/')
+
+ plugin = (
+ windows.WindowsWinDirEnvironmentVariablePlugin())
+ knowledge_base = self._RunPreprocessorPluginOnFileSystem(
+ file_system_builder.file_system, mount_point, plugin)
+
+ environment_variable = knowledge_base.GetEnvironmentVariable(u'WinDir')
+ self.assertIsNotNone(environment_variable)
+ self.assertEqual(environment_variable.value, u'\\Windows')
+
+
if __name__ == '__main__':
unittest.main()
« plaso/preprocessors/windows.py ('K') | « tests/preprocessors/test_lib.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b