本文整理汇总了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)
示例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.')
示例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.')