def test_create(self):
        """Test."""
        from invenio.ext.login.legacy_user import UserInfo
        from invenio_deposit.models import Deposition

        user = UserInfo(uid=1)
        d = Deposition.create(user)
        assert d.type == self.DefaultType
        assert Deposition.get(d.id).type == self.DefaultType
        d2 = Deposition.create(user, type=self.AnotherType)
        assert d2.type == self.AnotherType
        assert Deposition.get(d2.id).type == self.AnotherType

        # remove the records
        Deposition.delete(d)
        Deposition.delete(d2)
    def test_create(self):
        """Test."""
        from invenio_ext.login.legacy_user import UserInfo
        from invenio_deposit.models import Deposition

        user = UserInfo(uid=1)
        d = Deposition.create(user)
        assert d.type == self.DefaultType
        assert Deposition.get(d.id).type == self.DefaultType
        d2 = Deposition.create(user, type=self.AnotherType)
        assert d2.type == self.AnotherType
        assert Deposition.get(d2.id).type == self.AnotherType

        # remove the records
        Deposition.delete(d)
        Deposition.delete(d2)
Esempio n. 3
0
    def run_deposition_tasks(self, deposition_id, with_webcoll=True):
        """
        Run all task ids specified in the latest SIP and optionally run
        webcoll.
        """
        # Run submitted tasks
        from invenio_deposit.models import Deposition
        dep = Deposition.get(deposition_id)
        sip = dep.get_latest_sip(sealed=True)

        for task_id in sip.task_ids:
            self.run_task_id(task_id)

        if with_webcoll:
            # Check if record is accessible
            response = self.client.get(
                url_for('record.metadata', recid=sip.metadata['recid']),
                base_url=self.app.config['CFG_SITE_SECURE_URL'],
            )
            self.assertStatus(response, 200)
Esempio n. 4
0
    def run_deposition_tasks(self, deposition_id, with_webcoll=True):
        """
        Run all task ids specified in the latest SIP and optionally run
        webcoll.
        """
        # Run submitted tasks
        from invenio_deposit.models import Deposition
        dep = Deposition.get(deposition_id)
        sip = dep.get_latest_sip(sealed=True)

        for task_id in sip.task_ids:
            self.run_task_id(task_id)

        if with_webcoll:
            # Check if record is accessible
            response = self.client.get(
                url_for('record.metadata', recid=sip.metadata['recid']),
                base_url=self.app.config['CFG_SITE_SECURE_URL'],
            )
            self.assertStatus(response, 200)