本文整理汇总了Python中invenio.modules.workflows.models.BibWorkflowObject.get_tasks_results方法的典型用法代码示例。如果您正苦于以下问题:Python BibWorkflowObject.get_tasks_results方法的具体用法?Python BibWorkflowObject.get_tasks_results怎么用?Python BibWorkflowObject.get_tasks_results使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio.modules.workflows.models.BibWorkflowObject
的用法示例。
在下文中一共展示了BibWorkflowObject.get_tasks_results方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_workflows_tasks
# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import get_tasks_results [as 别名]
def test_workflows_tasks(self):
"""Test delayed workflows in non delayed one."""
from invenio.modules.workflows.models import BibWorkflowObject
from invenio.modules.workflows.api import start
test_object = BibWorkflowObject()
test_object.save()
test_object.set_data(22)
engine = start("test_workflow_workflows", [test_object], module_name="unit_tests")
from invenio.modules.workflows.engine import WorkflowStatus
self.assertEqual(0, engine.get_extra_data()["_nb_workflow_failed"])
self.assertEqual(WorkflowStatus.COMPLETED, engine.status)
self.assertEqual(0, test_object.get_tasks_results()["review_workflow"][0]["result"]["failed"])
self.assertEqual(4, test_object.get_extra_data()["nbworkflowrunning"])
self.assertEqual(21, engine.get_extra_data()["_nb_workflow_finish"])
示例2: test_workflow_task_results
# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import get_tasks_results [as 别名]
def test_workflow_task_results(self):
"""Test the setting and getting of task results."""
from invenio.modules.workflows.models import BibWorkflowObject
test_object = BibWorkflowObject()
test_object.save() # Saving is needed to instantiate default values
test_object.add_task_result("test", {"data": "testing"})
results = test_object.get_tasks_results()
self.assertEqual(len(results.get("test")), 1)
result_item = results.get("test")[0]
self.assertEqual({"data": "testing"},
result_item.get("result"))
self.assertEqual("workflows/results/default.html",
result_item.get("template"))
self.assertEqual("test",
result_item.get("name"))