当前位置: 首页>>代码示例>>Python>>正文


Python NodeFactory.register_node方法代码示例

本文整理汇总了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)
开发者ID:adlius,项目名称:osf.io,代码行数:33,代码来源:test_registration_linked_registrations.py


注:本文中的osf_tests.factories.NodeFactory.register_node方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。