本文整理汇总了Python中osf_tests.factories.NodeFactory.register_node方法的典型用法代码示例。如果您正苦于以下问题:Python NodeFactory.register_node方法的具体用法?Python NodeFactory.register_node怎么用?Python NodeFactory.register_node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osf_tests.factories.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.register_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from osf_tests.factories import NodeFactory [as 别名]
# 或者: from osf_tests.factories.NodeFactory import register_node [as 别名]
def setUp(self):
super(LinkedRegistrationsTestCase, self).setUp()
self.mock_archive = mock.patch('website.archiver.tasks.archive')
self.non_contributor = AuthUserFactory()
self.read_contributor = AuthUserFactory()
self.rw_contributor = AuthUserFactory()
self.admin_contributor = AuthUserFactory()
self.public_linked_registration = RegistrationFactory(is_public=True, creator=self.rw_contributor)
self.private_linked_registration = RegistrationFactory(is_public=False, creator=self.rw_contributor)
self.mock_archive.start()
public_node = NodeFactory(creator=self.admin_contributor, is_public=True)
public_node.add_contributor(self.rw_contributor, auth=Auth(self.admin_contributor))
public_node.add_contributor(self.read_contributor, permissions=['read'], auth=Auth(self.admin_contributor))
public_node.add_pointer(self.public_linked_registration, auth=Auth(self.admin_contributor))
public_node.add_pointer(self.private_linked_registration, auth=Auth(self.rw_contributor))
public_node.save()
self.public_registration = public_node.register_node(get_default_metaschema(), Auth(self.admin_contributor), '', None)
self.public_registration.is_public = True
self.public_registration.save()
private_node = NodeFactory(creator=self.admin_contributor)
private_node.add_contributor(self.rw_contributor, auth=Auth(self.admin_contributor))
private_node.add_contributor(self.read_contributor, permissions=['read'], auth=Auth(self.admin_contributor))
private_node.add_pointer(self.public_linked_registration, auth=Auth(self.admin_contributor))
private_node.add_pointer(self.private_linked_registration, auth=Auth(self.rw_contributor))
private_node.save()
self.private_registration = private_node.register_node(get_default_metaschema(), Auth(self.admin_contributor), '', None)