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


Python AnonymousTaskRunFactory.build方法代码示例

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


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

示例1: test_anonymous_user_create_repeated_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_repeated_taskrun(self):
        """Test anonymous user cannot create two taskruns for the same task"""
        task = TaskFactory.create()
        taskrun1 = AnonymousTaskRunFactory.create(task=task)
        taskrun2 = AnonymousTaskRunFactory.build(task=task)

        assert_raises(Forbidden, ensure_authorized_to, 'create', taskrun2)
开发者ID:anukat2015,项目名称:pybossa,代码行数:9,代码来源:test_taskrun_auth.py

示例2: test_anonymous_user_create_first_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_first_taskrun(self):
        """Test anonymous user can create a taskrun for a given task if he
        hasn't already done it"""
        task = TaskFactory.create()
        taskrun = AnonymousTaskRunFactory.build(task=task)

        assert_not_raises(Exception, ensure_authorized_to, 'create', taskrun)
开发者ID:anukat2015,项目名称:pybossa,代码行数:9,代码来源:test_taskrun_auth.py

示例3: test_anonymous_user_create_taskrun_non_allow_anonymous_contrib

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_taskrun_non_allow_anonymous_contrib(self):
        """Test anonymous user cannot create a taskrun for a project that does
        not allow for anonymous contributors"""
        project = ProjectFactory.create(allow_anonymous_contributors=False)
        task = TaskFactory.create(project=project)
        taskrun = AnonymousTaskRunFactory.build(task=task)

        assert_raises(Unauthorized, ensure_authorized_to, 'create', taskrun)
开发者ID:anukat2015,项目名称:pybossa,代码行数:10,代码来源:test_taskrun_auth.py

示例4: test_anonymous_user_create_repeated_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_repeated_taskrun(self):
        """Test anonymous user cannot create a taskrun for a task to which
        he has previously posted a taskrun"""
        task = TaskFactory.create()
        taskrun1 = AnonymousTaskRunFactory.create(task=task)
        taskrun2 = AnonymousTaskRunFactory.build(task=task)

        assert_raises(Forbidden, ensure_authorized_to, 'create', taskrun2)
开发者ID:chandra1b,项目名称:pybossa,代码行数:10,代码来源:test_taskrun_auth.py

示例5: test_anonymous_user_create_taskrun_non_allow_anonymous_contrib

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_taskrun_non_allow_anonymous_contrib(self):
        """Test anonymous user cannot create a taskrun for a project that does
        not allow for anonymous contributors"""

        project = AppFactory.create(allow_anonymous_contributors=False)
        task = TaskFactory.create(app=project)
        taskrun = AnonymousTaskRunFactory.build(task=task)

        assert_raises(Unauthorized, getattr(require, 'taskrun').create, taskrun)
开发者ID:alisheikh,项目名称:pybossa,代码行数:11,代码来源:test_taskrun_auth.py

示例6: test_anonymous_user_create_repeated_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_repeated_taskrun(self):
        """Test anonymous user cannot create a taskrun for a task to which
        he has previously posted a taskrun"""

        with self.flask_app.test_request_context('/'):
            task = TaskFactory.create()
            taskrun1 = AnonymousTaskRunFactory.create(task=task)
            taskrun2 = AnonymousTaskRunFactory.build(task=task)
            assert_raises(Forbidden,
                        getattr(require, 'taskrun').create,
                        taskrun2)

            # But the user can still create taskruns for different tasks
            task2 = TaskFactory.create(app=task.app)
            taskrun3 = AnonymousTaskRunFactory.build(task=task2)
            assert_not_raises(Exception,
                          getattr(require, 'taskrun').create,
                          taskrun3)
开发者ID:fesp21,项目名称:pybossa,代码行数:20,代码来源:test_taskrun_auth.py

示例7: test_anonymous_user_create_first_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_first_taskrun(self):
        """Test anonymous user can create a taskrun for a given task if he
        hasn't already done it"""

        taskrun = AnonymousTaskRunFactory.build()

        assert_not_raises(Exception,
                        getattr(require, 'taskrun').create,
                        taskrun)
开发者ID:chamaa,项目名称:pybossa,代码行数:11,代码来源:test_taskrun_auth.py

示例8: test_anonymous_user_can_create_taskrun_for_draft_project

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_can_create_taskrun_for_draft_project(self):
        """Test anonymous users can create a taskrun for a project that
        is a draft"""
        project = ProjectFactory.create(published=False)
        task = TaskFactory.create(project=project)
        taskrun = AnonymousTaskRunFactory.build(task_id=task.id,
                                                project_id=project.id)

        assert_not_raises(Forbidden, ensure_authorized_to, 'create', taskrun)
开发者ID:anukat2015,项目名称:pybossa,代码行数:11,代码来源:test_taskrun_auth.py

示例9: test_anonymous_user_create_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_taskrun(self):
        """Test anonymous user can create a taskrun for a task even though
        he has posted taskruns for different tasks in the same project"""

        tasks = TaskFactory.create_batch(2)
        taskrun1 = AnonymousTaskRunFactory.create(task=tasks[0])
        taskrun2 = AnonymousTaskRunFactory.build(task_id=tasks[1].id)

        assert_not_raises(Exception,
                          ensure_authorized_to, 'create', taskrun2)
开发者ID:Skytim,项目名称:pybossa,代码行数:12,代码来源:test_taskrun_auth.py

示例10: test_anonymous_user_create_repeated_taskrun

# 需要导入模块: from factories import AnonymousTaskRunFactory [as 别名]
# 或者: from factories.AnonymousTaskRunFactory import build [as 别名]
    def test_anonymous_user_create_repeated_taskrun(self):
        """Test anonymous user cannot create a taskrun for a task to which
        he has previously posted a taskrun"""

        task = TaskFactory.create()
        taskrun1 = AnonymousTaskRunFactory.create(task=task)
        taskrun2 = AnonymousTaskRunFactory.build(task=task)
        assert_raises(Forbidden,
                    getattr(require, 'taskrun').create,
                    taskrun2)
开发者ID:alisheikh,项目名称:pybossa,代码行数:12,代码来源:test_taskrun_auth.py


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