def __init__(self, workflow_version): loader = BespinWorkflowLoader(workflow_version) parser = BespinWorkflowParser(loader.load()) prefix = loader.get_prefix() builder = ToolDetailsBuilder(prefix) builder.accept(parser.loaded_workflow) self.version = parser.version self.tag = parser.tag self.contents = builder.build()
def test_load(self, mock_cleanup, mock_load_downloaded_workflow, mock_handle_download, mock_download_workflow, mock_mkdtemp): self.setup_mkdtemp(mock_mkdtemp) loader = BespinWorkflowLoader(self.workflow_version) manager = Mock() manager.attach_mock(mock_download_workflow, 'download') manager.attach_mock(mock_handle_download, 'handle') manager.attach_mock(mock_load_downloaded_workflow, 'load_downloaded') manager.attach_mock(mock_cleanup, 'cleanup') loaded = loader.load() self.assertEqual(manager.mock_calls, [ call.download(), call.handle(), call.load_downloaded(), call.cleanup() ]) # Make sure we assert this check after the order, because it interferes with the calls self.assertEqual(loaded, mock_load_downloaded_workflow.return_value)