summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sphinx/websupport/errors.py6
-rw-r--r--tests/test_websupport.py11
2 files changed, 14 insertions, 3 deletions
diff --git a/sphinx/websupport/errors.py b/sphinx/websupport/errors.py
index fbb75a93d..e78abc217 100644
--- a/sphinx/websupport/errors.py
+++ b/sphinx/websupport/errors.py
@@ -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
diff --git a/tests/test_websupport.py b/tests/test_websupport.py
index e9c68cf63..2db29a2e1 100644
--- a/tests/test_websupport.py
+++ b/tests/test_websupport.py
@@ -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()