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)
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_')
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')
def trace(self, root_dir_path): retriever = DataRetriever(self.sender.send_message) with retriever.trace(root_dir_path) as tracer: yield tracer
def run(self, file_path): retriever = DataRetriever(self.sender.send_message) retriever.run(file_path)