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


Python ProjectFactory.comment_level方法代码示例

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


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

示例1: test_private_node_with_public_comment_level_non_contributor_cannot_comment

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import comment_level [as 别名]
 def test_private_node_with_public_comment_level_non_contributor_cannot_comment(self):
     """ Test non-contributors cannot comment on a private project
         with comment_level == 'public' """
     project = ProjectFactory(is_public=False, creator=self.user)
     project.comment_level = "public"
     project.save()
     url = "/{}nodes/{}/comments/".format(API_BASE, project._id)
     res = self.app.post_json_api(url, self.payload, auth=self.non_contributor.auth, expect_errors=True)
     assert_equal(res.status_code, 403)
开发者ID:Alpani,项目名称:osf.io,代码行数:11,代码来源:test_node_comments_list.py

示例2: test_public_node_non_contributor_commenter_cannot_update_own_comment_if_comment_level_private

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import comment_level [as 别名]
 def test_public_node_non_contributor_commenter_cannot_update_own_comment_if_comment_level_private(self):
     project = ProjectFactory(is_public=True, comment_level='public')
     comment = CommentFactory(node=project, user=self.non_contributor)
     project.comment_level = 'private'
     project.save()
     url = '/{}comments/{}/'.format(API_BASE, comment._id)
     payload = self._set_up_payload(comment._id)
     res = self.app.put_json_api(url, payload, auth=self.non_contributor.auth, expect_errors=True)
     assert_equal(res.status_code, 403)
     assert_equal(res.json['errors'][0]['detail'], 'You do not have permission to perform this action.')
开发者ID:baylee-d,项目名称:osf.io,代码行数:12,代码来源:test_comment_detail.py

示例3: test_public_node_non_contributor_commenter_cannot_update_own_comment_if_comment_level_private

# 需要导入模块: from tests.factories import ProjectFactory [as 别名]
# 或者: from tests.factories.ProjectFactory import comment_level [as 别名]
 def test_public_node_non_contributor_commenter_cannot_update_own_comment_if_comment_level_private(self):
     project = ProjectFactory(is_public=True, comment_level='public')
     comment = CommentFactory(node=project, target=project, user=self.non_contributor)
     project.comment_level = 'private'
     project.save()
     url = '/{}comments/{}/'.format(API_BASE, comment._id)
     payload = {
         'data': {
             'id': comment._id,
             'type': 'comments',
             'attributes': {
                 'content': 'Updating this comment',
                 'deleted': False
             }
         }
     }
     res = self.app.put_json_api(url, payload, auth=self.non_contributor.auth, expect_errors=True)
     assert_equal(res.status_code, 403)
     assert_equal(res.json['errors'][0]['detail'], 'You do not have permission to perform this action.')
开发者ID:AllisonLBowers,项目名称:osf.io,代码行数:21,代码来源:test_comment_detail.py


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