Пример #1
0
    def test_it_runs_dissect_on_the_file(self, dissect):
        # Arrange
        retriever = Retriever(Mock())

        # Act
        retriever.run("fake/file")

        # Assert
        dissect.run.assert_called_once_with("fake/file", ANY)
Пример #2
0
    def test_it_converts_each_entity_to_json(self, entity2json, dissect):
        # Arrange
        retriever = Retriever(Mock())
        function = Function(id_='func1', name='function1')

        # Act
        retriever.on_entity(function)

        # Assert
        entity2json.convert.assert_called_once_with(function, 'id_')
Пример #3
0
    def test_it_calls_back_with_each_entity_in_json(self, entity2json, dissect):
        # Arrange
        callback = Mock()
        retriever = Retriever(callback)
        function = Function(id_='func1', name='function1')
        entity2json.convert.return_value = 'fake json'

        # Act
        retriever.on_entity(function)

        # Assert
        callback.assert_called_once_with('fake json')
Пример #4
0
 def trace(self, root_dir_path):
     retriever = DataRetriever(self.sender.send_message)
     with retriever.trace(root_dir_path) as tracer:
         yield tracer
Пример #5
0
 def run(self, file_path):
     retriever = DataRetriever(self.sender.send_message)
     retriever.run(file_path)