本文整理汇总了Python中tests.factories.ProjectFactory.is_contributor方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectFactory.is_contributor方法的具体用法?Python ProjectFactory.is_contributor怎么用?Python ProjectFactory.is_contributor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.factories.ProjectFactory
的用法示例。
在下文中一共展示了ProjectFactory.is_contributor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_do_migration
# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import is_contributor [as 别名]
def test_do_migration(self):
user1 = UserFactory()
fullname1 = 'Presentation Service'
email1 = '[email protected]'
project1 = ProjectFactory(creator=user1)
user2 = project1.add_unregistered_contributor(
fullname=fullname1, email=email1, auth=Auth(user=user1)
)
project1.save()
user3 = UserFactory.build(username='[email protected]', fullname=fullname1)
user3.save()
project2 = ProjectFactory(creator=user1)
project2.add_contributor(user3)
project2.save()
assert project1.is_contributor(user2) is True
assert len(project1.contributors) is 2
assert project2.is_contributor(user3) is True
assert len(project2.contributors) is 2
user_list = get_targets()
do_migration(user_list)
assert project2.is_contributor(user3) is False
assert len(project2.contributors) is 1
assert project1.is_contributor(user2) is False
assert len(project1.contributors) is 1
assert user2.is_disabled is True
assert user3.is_disabled is True
示例2: test_migrate_project_contributed
# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import is_contributor [as 别名]
def test_migrate_project_contributed(self):
user1 = UserFactory()
fullname1 = 'hello world'
email1 = '[email protected]'
project1 = ProjectFactory(creator=user1)
user2 = project1.add_unregistered_contributor(
fullname=fullname1, email=email1, auth=Auth(user=user1)
)
project1.save()
assert project1.is_contributor(user2) is True
assert len(project1.contributors) is 2
migrate_project_contributed(user2)
assert project1.is_contributor(user2) is False
assert len(project1.contributors) is 1
user3 = UserFactory()
project2 = ProjectFactory(creator=user1)
project2.add_contributor(user3)
project2.save()
assert project2.is_contributor(user3) is True
assert len(project2.contributors) is 2
migrate_project_contributed(user3)
assert project2.is_contributor(user3) is False
assert len(project2.contributors) is 1