本文整理汇总了Python中osf_tests.factories.NodeFactory.get_addon方法的典型用法代码示例。如果您正苦于以下问题:Python NodeFactory.get_addon方法的具体用法?Python NodeFactory.get_addon怎么用?Python NodeFactory.get_addon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osf_tests.factories.NodeFactory
的用法示例。
在下文中一共展示了NodeFactory.get_addon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fork_reverts_to_using_user_storage_default
# 需要导入模块: from osf_tests.factories import NodeFactory [as 别名]
# 或者: from osf_tests.factories.NodeFactory import get_addon [as 别名]
def test_fork_reverts_to_using_user_storage_default(self):
user = UserFactory()
user2 = UserFactory()
us = RegionFactory()
canada = RegionFactory()
user_settings = user.get_addon('osfstorage')
user_settings.default_region = us
user_settings.save()
user2_settings = user2.get_addon('osfstorage')
user2_settings.default_region = canada
user2_settings.save()
project = ProjectFactory(creator=user, is_public=True)
child = NodeFactory(parent=project, creator=user, is_public=True)
child_settings = child.get_addon('osfstorage')
child_settings.region_id = canada.id
child_settings.save()
fork = project.fork_node(Auth(user))
child_fork = models.Node.objects.get_children(fork).first()
assert fork.get_addon('osfstorage').region_id == us.id
assert fork.get_addon('osfstorage').user_settings == user.get_addon('osfstorage')
assert child_fork.get_addon('osfstorage').region_id == us.id
fork = project.fork_node(Auth(user2))
child_fork = models.Node.objects.get_children(fork).first()
assert fork.get_addon('osfstorage').region_id == canada.id
assert fork.get_addon('osfstorage').user_settings == user2.get_addon('osfstorage')
assert child_fork.get_addon('osfstorage').region_id == canada.id