当前位置: 首页>>代码示例>>Python>>正文


Python BibWorkflowObject.delete方法代码示例

本文整理汇总了Python中invenio.modules.workflows.models.BibWorkflowObject.delete方法的典型用法代码示例。如果您正苦于以下问题:Python BibWorkflowObject.delete方法的具体用法?Python BibWorkflowObject.delete怎么用?Python BibWorkflowObject.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在invenio.modules.workflows.models.BibWorkflowObject的用法示例。


在下文中一共展示了BibWorkflowObject.delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_self_and_stop_processing

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import delete [as 别名]
def delete_self_and_stop_processing(obj, eng):
    """Delete both versions of itself and stops the workflow."""
    from invenio.modules.workflows.models import BibWorkflowObject
    # delete snapshot created with original data
    initial_obj = BibWorkflowObject.query.filter(
        BibWorkflowObject.id_parent == obj.id
    ).one()
    BibWorkflowObject.delete(initial_obj.id)
    # delete self
    BibWorkflowObject.delete(obj.id)
    eng.skipToken()
开发者ID:Lilykos,项目名称:inspire-next,代码行数:13,代码来源:matching.py

示例2: test_workflow_without_workflow_object_saved

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import delete [as 别名]
    def test_workflow_without_workflow_object_saved(self):
        """Test that the logic tasks work correctly."""
        from invenio.modules.workflows.models import BibWorkflowObject
        from invenio.modules.workflows.api import start, start_by_wid

        test_object = BibWorkflowObject()
        test_object.set_data(0)
        test_object.save()

        workflow = start('test_workflow_logic', [test_object], module_name="unit_tests")

        self.assertEqual(5, test_object.get_data())
        self.assertEqual("lt9", test_object.get_extra_data()["test"])
        start_by_wid(workflow.uuid)
        test_object.delete(test_object.id)
开发者ID:kasioumis,项目名称:invenio,代码行数:17,代码来源:test_workflows.py

示例3: TestWorkflowModels

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import delete [as 别名]
class TestWorkflowModels(InvenioTestCase):

    """Test meant for testing the models available."""

    def setUp(self):
        """Setup tests."""
        from invenio.modules.workflows.models import BibWorkflowObject, \
            Workflow
        from uuid import uuid1 as new_uuid

        self.workflow = Workflow(name='test_workflow', uuid=new_uuid(),
                                 id_user=0, module_name="Unknown")
        self.bibworkflowobject = BibWorkflowObject(workflow=self.workflow)

        self.create_objects([self.workflow, self.bibworkflowobject])

    def tearDown(self):
        """Clean up tests."""
        self.delete_objects([self.workflow, self.bibworkflowobject])

    def test_deleting_workflow(self):
        """Test deleting workflow."""
        from invenio.modules.workflows.models import BibWorkflowObject, \
            Workflow
        bwo_id = self.bibworkflowobject.id

        # delete workflow
        Workflow.delete(self.workflow.uuid)

        # assert bibworkflowobject is deleted
        self.assertFalse(
            db.session.query(
                BibWorkflowObject.query.filter(
                    BibWorkflowObject.id == bwo_id).exists()).scalar())

    def test_deleting_bibworkflowobject(self):
        """Test deleting workflowobject."""
        from invenio.modules.workflows.models import Workflow
        w_uuid = self.workflow.uuid

        # delete bibworkflowobject
        self.bibworkflowobject.delete(self.bibworkflowobject.id)

        # assert workflow is not deleted
        self.assertTrue(
            db.session.query(
                Workflow.query.filter(
                    Workflow.uuid == w_uuid).exists()).scalar())
开发者ID:dset0x,项目名称:invenio,代码行数:50,代码来源:test_workflows_model.py

示例4: test_workflow_for_running_object

# 需要导入模块: from invenio.modules.workflows.models import BibWorkflowObject [as 别名]
# 或者: from invenio.modules.workflows.models.BibWorkflowObject import delete [as 别名]
    def test_workflow_for_running_object(self):
        """Test workflow with running object given and watch it fail."""
        from invenio.modules.workflows.models import (BibWorkflowObject,
                                                      ObjectVersion)
        from invenio.modules.workflows.api import start_by_oids
        from invenio.modules.workflows.errors import WorkflowObjectVersionError

        obj_running = BibWorkflowObject()
        obj_running.set_data(1234)
        obj_running.save(version=ObjectVersion.RUNNING)

        try:
            start_by_oids('test_workflow', [obj_running.id], module_name="unit_tests")
        except Exception as e:
            self.assertTrue(isinstance(e, WorkflowObjectVersionError))
            obj_running.delete(e.id_object)
        obj_running.delete(obj_running)
        obj_running = BibWorkflowObject()
        obj_running.set_data(1234)
        obj_running.save(version=ObjectVersion.RUNNING)
        try:
            start_by_oids('test_workflow', [obj_running.id], module_name="unit_tests")
        except Exception as e:
            self.assertTrue(isinstance(e, WorkflowObjectVersionError))
            obj_running.delete(e.id_object)
        obj_running.delete(obj_running)

        obj_running = BibWorkflowObject()
        obj_running.set_data(1234)
        obj_running.save(version=5)
        try:
            start_by_oids('test_workflow', [obj_running.id],
                          module_name="unit_tests")
        except Exception as e:
            self.assertTrue(isinstance(e, WorkflowObjectVersionError))
            obj_running.delete(e.id_object)
        obj_running.delete(obj_running)
开发者ID:kasioumis,项目名称:invenio,代码行数:39,代码来源:test_workflows.py


注:本文中的invenio.modules.workflows.models.BibWorkflowObject.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。