Ensure hidden comments can't be replied to

This commit is contained in:
Jacob Mason 2010-08-05 15:01:13 -05:00
parent d0e272e61f
commit fbd047b8f5
2 changed files with 14 additions and 3 deletions

View File

@ -10,7 +10,7 @@
"""
__all__ = ['DocumentNotFoundError', 'SrcdirNotSpecifiedError',
'UserNotAuthorizedError']
'UserNotAuthorizedError', 'CommentNotAllowedError']
class DocumentNotFoundError(Exception):
pass
@ -22,3 +22,7 @@ class SrcdirNotSpecifiedError(Exception):
class UserNotAuthorizedError(Exception):
pass
class CommentNotAllowedError(Exception):
pass

View File

@ -81,8 +81,14 @@ def test_comments(support):
comment = support.add_comment('First test comment',
node_id=str(first_node.id),
username='user_one')
support.add_comment('Hidden comment', node_id=str(first_node.id),
displayed=False)
hidden_comment = support.add_comment('Hidden comment',
node_id=str(first_node.id),
displayed=False)
# Make sure that comments can't be added to a comment where
# displayed == False, since it could break the algorithm that
# converts a nodes comments to a tree.
raises(CommentNotAllowedError, support.add_comment, 'Not allowed',
parent_id=str(hidden_comment['id']))
# Add a displayed and not displayed child to the displayed comment.
support.add_comment('Child test comment', parent_id=str(comment['id']),
username='user_one')
@ -144,6 +150,7 @@ def test_voting(support):
comment = data['comments'][0]
assert comment['vote'] == 1, '%s != 1' % comment['vote']
@with_support()
def test_proposals(support):
session = Session()