summaryrefslogtreecommitdiff
path: root/tests/test_websupport.py
diff options
context:
space:
mode:
authorJacob Mason <jacoblmason@gmail.com>2010-07-31 15:51:13 -0500
committerJacob Mason <jacoblmason@gmail.com>2010-07-31 15:51:13 -0500
commit682fa466fe70704c7e58c703a387dcb082f56518 (patch)
tree8f3353a88f8ab6f1ce05fc56c3b32df9a48f3d9c /tests/test_websupport.py
parenta31f3b7e73f2050efab07a9ed143c72e774af452 (diff)
downloadsphinx-git-682fa466fe70704c7e58c703a387dcb082f56518.tar.gz
Added test for comment system.
Diffstat (limited to 'tests/test_websupport.py')
-rw-r--r--tests/test_websupport.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/test_websupport.py b/tests/test_websupport.py
index 3f352cd6c..53307fb4e 100644
--- a/tests/test_websupport.py
+++ b/tests/test_websupport.py
@@ -14,6 +14,8 @@ from StringIO import StringIO
from sphinx.websupport import WebSupport
from sphinx.websupport.errors import *
+from sphinx.websupport.comments.sqlalchemystorage import Session
+from sphinx.websupport.comments.db import Node
try:
from functools import wraps
@@ -116,10 +118,25 @@ def test_xapian():
def test_whoosh():
- # Don't run tests if xapian is not installed.
+ # Don't run tests if whoosh is not installed.
try:
import whoosh
search_adapter_helper('whoosh')
except ImportError:
- sys.stderr.write('info: not running xapian tests, ' \
+ sys.stderr.write('info: not running whoosh tests, ' \
'whoosh doesn\'t seem to be installed')
+
+
+@with_support()
+def test_comments(support):
+ session = Session()
+ node = session.query(Node).first()
+ comment = support.add_comment('First test comment', node=str(node.id))
+ support.add_comment('Child test comment', parent=str(comment['id']))
+ data = support.get_comments(str(node.id))
+ comments = data['comments']
+ children = comments[0]['children']
+ assert len(comments) == 1
+ assert comments[0]['text'] == 'First test comment'
+ assert len(children) == 1
+ assert children[0]['text'] == 'Child test comment'