本文整理匯總了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)