Ejemplo n.º 1
0
  def testAddStorageFileOptions(self):
    """Tests the AddStorageFileOptions function."""
    argument_parser = argparse.ArgumentParser(
        prog=u'analysis_tool_test.py', description=u'Test argument parser.',
        add_help=False, formatter_class=argparse.RawDescriptionHelpFormatter)

    test_tool = analysis_tool.AnalysisTool()
    test_tool.AddStorageFileOptions(argument_parser)

    output = self._RunArgparseFormatHelp(argument_parser)
    self.assertEqual(output, self._EXPECTED_OUTPUT_STORAGE_FILE_OPTIONS)
Ejemplo n.º 2
0
  def testParseOptions(self):
    """Tests the ParseOptions function."""
    test_tool = analysis_tool.AnalysisTool()

    options = test_lib.TestOptions()

    with self.assertRaises(errors.BadConfigOption):
      test_tool.ParseOptions(options)

    options.storage_file = self._GetTestFilePath([u'psort_test.json.plaso'])

    test_tool.ParseOptions(options)
Ejemplo n.º 3
0
    def testAddStorageFileOptions(self):
        """Tests the AddStorageFileOptions function."""
        argument_parser = argparse.ArgumentParser(
            prog=u'analysis_tool_test.py',
            description=u'Test argument parser.')

        output = argument_parser.format_help()
        self.assertEqual(output, self._EXPECTED_OUTPUT_DEFAULT)

        test_tool = analysis_tool.AnalysisTool()
        test_tool.AddStorageFileOptions(argument_parser)

        output = argument_parser.format_help()
        self.assertEqual(output, self._EXPECTED_OUTPUT_STORAGE_FILE_OPTIONS)