def setUp(self):
        """Test."""
        from invenio_deposit.models import DepositionType
        from invenio_deposit.registry import deposit_types, \
            deposit_default_type

        # Unregister any default types
        try:
            deposit_default_type.unregister()
        except RegistryError:
            pass

        # Create some test types.
        class DefaultType(DepositionType):
            pass

        class AnotherType(DepositionType):
            pass

        # Register types
        self.DefaultType = DefaultType
        self.AnotherType = AnotherType
        deposit_types.register(DefaultType)
        deposit_types.register(AnotherType)
        deposit_default_type.register(DefaultType)
Пример #2
0
    def setUp(self):
        """Setup tests."""
        from invenio_deposit.models import Deposition, DepositionType
        from invenio_deposit.registry import deposit_types, deposit_default_type
        from invenio_deposit.form import WebDepositForm
        from invenio_deposit.tasks import prefill_draft, prepare_sip

        celery.conf["CELERY_ALWAYS_EAGER"] = True

        def agnostic_task(obj, eng):
            data_model = eng.workflow_definition.model(obj)
            sip = data_model.get_latest_sip()
            print(sip.metadata)

        class DefaultType(DepositionType):
            pass

        class SimpleRecordTestForm(WebDepositForm):
            pass

        class DepositModelTest(DepositionType):

            """A test workflow for the model."""

            model = Deposition

            draft_definitions = {"default": SimpleRecordTestForm}

            workflow = [prefill_draft(draft_id="default"), prepare_sip(), agnostic_task]

        deposit_types.register(DefaultType)
        deposit_types.register(DepositModelTest)
        deposit_default_type.register(DefaultType)
    def setUp(self):
        """Test."""
        from invenio_deposit.models import DepositionType
        from invenio_deposit.registry import deposit_types, \
            deposit_default_type

        # Unregister any default types
        try:
            deposit_default_type.unregister()
        except RegistryError:
            pass

        # Create some test types.
        class DefaultType(DepositionType):
            pass

        class AnotherType(DepositionType):
            pass

        # Register types
        self.DefaultType = DefaultType
        self.AnotherType = AnotherType
        deposit_types.register(DefaultType)
        deposit_types.register(AnotherType)
        deposit_default_type.register(DefaultType)
Пример #4
0
 def register(self, deposition_type):
     """ Register the deposition type """
     from invenio_deposit.registry import deposit_types
     from invenio_deposit.url_converters import refresh_url_map
     deposit_types.register(deposition_type)
     assert deposition_type in deposit_types
     self.deposition_type = deposition_type
     refresh_url_map(self.app)
Пример #5
0
 def register(self, deposition_type):
     """ Register the deposition type """
     from invenio_deposit.registry import deposit_types
     from invenio_deposit.url_converters import refresh_url_map
     deposit_types.register(deposition_type)
     assert deposition_type in deposit_types
     self.deposition_type = deposition_type
     refresh_url_map(self.app)