當前位置: 首頁>>代碼示例>>Python>>正文


Python BibWorkflowObject.get_tasks_results方法代碼示例

本文整理匯總了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"])
開發者ID:k3njiy,項目名稱:invenio,代碼行數:18,代碼來源:test_workflows_delayed.py

示例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"))
開發者ID:kasioumis,項目名稱:invenio,代碼行數:20,代碼來源:test_workflows.py


注:本文中的invenio.modules.workflows.models.BibWorkflowObject.get_tasks_results方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。