本文整理汇总了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)
示例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)
示例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")