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


Python RegistrationFactory.is_public方法代码示例

本文整理汇总了Python中tests.factories.RegistrationFactory.is_public方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationFactory.is_public方法的具体用法?Python RegistrationFactory.is_public怎么用?Python RegistrationFactory.is_public使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.factories.RegistrationFactory的用法示例。


在下文中一共展示了RegistrationFactory.is_public方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_public_node_register_page

# 需要导入模块: from tests.factories import RegistrationFactory [as 别名]
# 或者: from tests.factories.RegistrationFactory import is_public [as 别名]
 def test_is_public_node_register_page(self):
     self.node.is_public = True
     self.node.save()
     reg = RegistrationFactory(project=self.node)
     reg.is_public = True
     reg.save()
     url = reg.web_url_for('node_register_page')
     res = self.app.get(url, auth=None)
     assert_equal(res.status_code, http.OK)
开发者ID:Alpani,项目名称:osf.io,代码行数:11,代码来源:test_views.py

示例2: test_get_recent_public_registrations

# 需要导入模块: from tests.factories import RegistrationFactory [as 别名]
# 或者: from tests.factories.RegistrationFactory import is_public [as 别名]
    def test_get_recent_public_registrations(self):

        count = 0
        for i in range(5):
            reg = RegistrationFactory()
            reg.is_public = True
            count = count + 1
            tdiff = datetime.datetime.now() - datetime.timedelta(days=count)
            self.set_registered_date(reg, tdiff)
        regs = [r for r in project_utils.recent_public_registrations()]
        assert_equal(len(regs), 5)
        for i in range(4):
            assert_true(regs[i].registered_date > regs[i + 1].registered_date)
        for i in range(5):
            reg = RegistrationFactory()
            reg.is_public = True
            count = count + 1
            tdiff = datetime.datetime.now() - datetime.timedelta(days=count)
            self.set_registered_date(reg, tdiff)
        regs = [r for r in project_utils.recent_public_registrations(7)]
        assert_equal(len(regs), 7)
开发者ID:XTech2K,项目名称:osf.io,代码行数:23,代码来源:test_utils.py

示例3: test_get_node_name

# 需要导入模块: from tests.factories import RegistrationFactory [as 别名]
# 或者: from tests.factories.RegistrationFactory import is_public [as 别名]
    def test_get_node_name(self):
        user = UserFactory()
        auth = Auth(user=user)
        another_user = UserFactory()
        another_auth = Auth(user=another_user)

        # Public (Can View)
        public_project = ProjectFactory(is_public=True)
        collector = rubeus.NodeFileCollector(node=public_project, auth=another_auth)
        node_name = u"{0}: {1}".format(
            public_project.project_or_component.capitalize(), sanitize.unescape_entities(public_project.title)
        )
        assert_equal(collector._get_node_name(public_project), node_name)

        # Private  (Can't View)
        registration_private = RegistrationFactory(creator=user)
        registration_private.is_public = False
        registration_private.save()
        collector = rubeus.NodeFileCollector(node=registration_private, auth=another_auth)
        assert_equal(collector._get_node_name(registration_private), u"Private Registration")

        content = ProjectFactory(creator=user)
        node = ProjectFactory(creator=user)

        forked_private = node.fork_node(auth=auth)
        forked_private.is_public = False
        forked_private.save()
        collector = rubeus.NodeFileCollector(node=forked_private, auth=another_auth)
        assert_equal(collector._get_node_name(forked_private), u"Private Fork")

        pointer_private = node.add_pointer(content, auth=auth)
        pointer_private.is_public = False
        pointer_private.save()
        collector = rubeus.NodeFileCollector(node=pointer_private, auth=another_auth)
        assert_equal(collector._get_node_name(pointer_private), u"Private Link")

        private_project = ProjectFactory(is_public=False)
        collector = rubeus.NodeFileCollector(node=private_project, auth=another_auth)
        assert_equal(collector._get_node_name(private_project), u"Private Component")

        private_node = NodeFactory(is_public=False)
        collector = rubeus.NodeFileCollector(node=private_node, auth=another_auth)
        assert_equal(collector._get_node_name(private_node), u"Private Component")
开发者ID:Alpani,项目名称:osf.io,代码行数:45,代码来源:test_rubeus.py


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