예제 #1
0
 def testSetup(self, mock_add_error):
     """Tests that no paths specified in setup will generate an error."""
     test_state = state.DFTimewolfState()
     filesystem_collector = filesystem.FilesystemCollector(test_state)
     filesystem_collector.setup(paths=None)
     mock_add_error.assert_called_with(
         'No `paths` argument provided in recipe, bailing', critical=True)
     self.assertIsNone(filesystem_collector._paths)  # pylint: disable=protected-access
예제 #2
0
 def testOutput(self, mock_exists):
     """Tests that the module ouput is consistent with the input."""
     test_state = state.DFTimewolfState(config.Config)
     filesystem_collector = filesystem.FilesystemCollector(test_state)
     fake_paths = '/fake/path/1,/fake/path/2'
     filesystem_collector.setup(paths=fake_paths)
     mock_exists.return_value = True
     filesystem_collector.process()
     expected_output = [('1', '/fake/path/1'), ('2', '/fake/path/2')]
     self.assertEqual(test_state.output, expected_output)
예제 #3
0
  def testSetup(self):
    """Tests that no paths specified in setup will generate an error."""
    test_state = state.DFTimewolfState(config.Config)
    filesystem_collector = filesystem.FilesystemCollector(test_state)
    with self.assertRaises(errors.DFTimewolfError) as error:
      filesystem_collector.SetUp(paths=None)
    self.assertEqual(
        'No `paths` argument provided in recipe, bailing',
        error.exception.message)

    self.assertIsNone(filesystem_collector._paths)  # pylint: disable=protected-access
예제 #4
0
 def testOutput(self, mock_exists):
   """Tests that the module output is consistent with the input."""
   test_state = state.DFTimewolfState(config.Config)
   filesystem_collector = filesystem.FilesystemCollector(test_state)
   fake_paths = '/fake/path/1,/fake/path/2'
   filesystem_collector.SetUp(paths=fake_paths)
   mock_exists.return_value = True
   filesystem_collector.Process()
   files = test_state.GetContainers(containers.File)
   self.assertEqual(files[0].path, '/fake/path/1')
   self.assertEqual(files[0].name, '1')
   self.assertEqual(files[1].path, '/fake/path/2')
   self.assertEqual(files[1].name, '2')
예제 #5
0
 def testInitialization(self):
     """Tests that the collector can be initialized."""
     test_state = state.DFTimewolfState()
     filesystem_collector = filesystem.FilesystemCollector(test_state)
     self.assertIsNotNone(filesystem_collector)