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

Unified Diff: tests/cli/pinfo_tool.py

Issue 321000043: [plaso] Refactored log2timeline front-end to tool #160 (Closed)
Patch Set: Updated review script 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
Index: tests/cli/pinfo_tool.py
diff --git a/tools/pinfo_test.py b/tests/cli/pinfo_tool.py
similarity index 90%
rename from tools/pinfo_test.py
rename to tests/cli/pinfo_tool.py
index a69d56e9efcecc036c59ac0ccf05ce746ba2af69..fa83e7a039116d163f3e27ccebf57dd767eb588c 100644
--- a/tools/pinfo_test.py
+++ b/tests/cli/pinfo_tool.py
@@ -6,15 +6,14 @@ import json
import unittest
from plaso.cli import views as cli_views
+from plaso.cli import pinfo_tool
from plaso.lib import errors
from plaso.lib import timelib
-from tests.cli import test_lib as cli_test_lib
+from tests.cli import test_lib
-from tools import pinfo
-
-class PinfoToolTest(cli_test_lib.CLIToolTestCase):
+class PinfoToolTest(test_lib.CLIToolTestCase):
"""Tests for the pinfo CLI tool."""
# TODO: add test for _CalculateStorageCounters.
@@ -32,13 +31,13 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
def testCompareStorages(self):
"""Tests the CompareStorages function."""
- output_writer = cli_test_lib.TestOutputWriter(encoding=u'utf-8')
- test_tool = pinfo.PinfoTool(output_writer=output_writer)
+ output_writer = test_lib.TestOutputWriter(encoding=u'utf-8')
+ test_tool = pinfo_tool.PinfoTool(output_writer=output_writer)
test_file1 = self._GetTestFilePath([u'psort_test.json.plaso'])
test_file2 = self._GetTestFilePath([u'pinfo_test.json.plaso'])
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
options.compare_storage_file = test_file1
options.storage_file = test_file1
@@ -49,7 +48,7 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
output = output_writer.ReadOutput()
self.assertEqual(output, b'Storages are identical.\n')
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
options.compare_storage_file = test_file1
options.storage_file = test_file2
@@ -62,8 +61,8 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
def testParseArguments(self):
"""Tests the ParseArguments function."""
- output_writer = cli_test_lib.TestOutputWriter(encoding=u'utf-8')
- test_tool = pinfo.PinfoTool(output_writer=output_writer)
+ output_writer = test_lib.TestOutputWriter(encoding=u'utf-8')
+ test_tool = pinfo_tool.PinfoTool(output_writer=output_writer)
result = test_tool.ParseArguments()
self.assertFalse(result)
@@ -73,15 +72,15 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
def testParseOptions(self):
"""Tests the ParseOptions function."""
- output_writer = cli_test_lib.TestOutputWriter(encoding=u'utf-8')
- test_tool = pinfo.PinfoTool(output_writer=output_writer)
+ output_writer = test_lib.TestOutputWriter(encoding=u'utf-8')
+ test_tool = pinfo_tool.PinfoTool(output_writer=output_writer)
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
options.storage_file = self._GetTestFilePath([u'pinfo_test.json.plaso'])
test_tool.ParseOptions(options)
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
with self.assertRaises(errors.BadConfigOption):
test_tool.ParseOptions(options)
@@ -90,8 +89,8 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
def testPrintStorageInformationAsText(self):
"""Tests the _PrintStorageInformationAsText function."""
- output_writer = cli_test_lib.TestOutputWriter(encoding=u'utf-8')
- test_tool = pinfo.PinfoTool(output_writer=output_writer)
+ output_writer = test_lib.TestOutputWriter(encoding=u'utf-8')
+ test_tool = pinfo_tool.PinfoTool(output_writer=output_writer)
test_filename = u'pinfo_test.json.plaso'
format_version = u'20170121'
@@ -200,7 +199,7 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
test_file = self._GetTestFilePath([test_filename])
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
options.storage_file = test_file
options.output_format = u'text'
@@ -220,11 +219,11 @@ class PinfoToolTest(cli_test_lib.CLIToolTestCase):
session_identifier = u'61d9fdf4b68f4ff39bd3f937a616d588'
session_start_time = timelib.Timestamp.CopyFromString(
u'2017-04-03 17:00:12.148946+00:00')
- output_writer = cli_test_lib.TestOutputWriter(encoding=u'utf-8')
- test_tool = pinfo.PinfoTool(output_writer=output_writer)
+ output_writer = test_lib.TestOutputWriter(encoding=u'utf-8')
+ test_tool = pinfo_tool.PinfoTool(output_writer=output_writer)
test_file = self._GetTestFilePath([test_filename])
- options = cli_test_lib.TestOptions()
+ options = test_lib.TestOptions()
options.storage_file = test_file
options.output_format = u'json'

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