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


Python ProjectFactory.is_contributor方法代码示例

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

示例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
开发者ID:545zhou,项目名称:osf.io,代码行数:30,代码来源:test_migrate_presentation_service.py


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