本文整理汇总了Python中invenio_deposit.models.Deposition.create方法的典型用法代码示例。如果您正苦于以下问题:Python Deposition.create方法的具体用法?Python Deposition.create怎么用?Python Deposition.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio_deposit.models.Deposition
的用法示例。
在下文中一共展示了Deposition.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import create [as 别名]
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)
示例2: test_agnostic_deposit
# 需要导入模块: from invenio_deposit.models import Deposition [as 别名]
# 或者: from invenio_deposit.models.Deposition import create [as 别名]
def test_agnostic_deposit(self):
"""A deposition still has the same data model."""
from invenio_deposit.models import Deposition
from invenio.ext.login.legacy_user import UserInfo
u = UserInfo(uid=1)
d = Deposition.create(u, type='DepositModelTest')
d.save()
d.run_workflow()
completed_object = d.engine.completed_objects[0]
for l in ['files', 'sips', 'type', 'drafts', 'title']:
self.assertIn(l, completed_object.data)