summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-10-06 14:28:18 +0200
committerGeorg Brandl <georg@python.org>2011-10-06 14:28:18 +0200
commitd92dabb1d9d02abf2e26540120a64bb4d3eb4484 (patch)
tree68449d0bc2666d1b9881da492524120c0bc4a9d9
parent68f68bdf37b1602b4463f2f6891159b13cb70c91 (diff)
downloadsphinx-d92dabb1d9d02abf2e26540120a64bb4d3eb4484.tar.gz
Update the websupport tests to API changes.
-rw-r--r--sphinx/themes/basic/static/websupport.js2
-rw-r--r--tests/test_websupport.py30
2 files changed, 13 insertions, 19 deletions
diff --git a/sphinx/themes/basic/static/websupport.js b/sphinx/themes/basic/static/websupport.js
index cbb60923..e9bd1b85 100644
--- a/sphinx/themes/basic/static/websupport.js
+++ b/sphinx/themes/basic/static/websupport.js
@@ -566,7 +566,7 @@
var context = $.extend({}, opts, comment);
var div = $(renderTemplate(commentTemplate, context));
- // If the user has voted on this comment, highblight the correct arrow.
+ // If the user has voted on this comment, highlight the correct arrow.
if (comment.vote) {
var direction = (comment.vote == 1) ? 'u' : 'd';
div.find('#' + direction + 'v' + comment.id).hide();
diff --git a/tests/test_websupport.py b/tests/test_websupport.py
index 87cc6ad4..d7b5fb32 100644
--- a/tests/test_websupport.py
+++ b/tests/test_websupport.py
@@ -18,8 +18,6 @@ except ImportError:
# functools is new in 2.5
wraps = lambda f: (lambda w: w)
-from nose import SkipTest
-
from sphinx.websupport import WebSupport
from sphinx.websupport.errors import *
from sphinx.websupport.storage import StorageBackend
@@ -35,8 +33,6 @@ except ImportError:
from util import *
-raise SkipTest('websupport tests are currently not working')
-
default_settings = {'builddir': os.path.join(test_root, 'websupport'),
'status': StringIO(),
'warning': StringIO()}
@@ -121,18 +117,18 @@ def test_comments(support):
comments = data['comments']
children = comments[0]['children']
assert len(comments) == 2
- assert comments[1]['text'] == 'Hidden comment'
+ assert comments[1]['text'] == '<p>Hidden comment</p>\n'
assert len(children) == 2
- assert children[1]['text'] == 'Hidden child test comment'
+ assert children[1]['text'] == '<p>Hidden child test comment</p>\n'
# Access the comments without being a moderator.
data = support.get_data(first_node.id)
comments = data['comments']
children = comments[0]['children']
assert len(comments) == 1
- assert comments[0]['text'] == 'First test comment'
+ assert comments[0]['text'] == '<p>First test comment</p>\n'
assert len(children) == 1
- assert children[0]['text'] == 'Child test comment'
+ assert children[0]['text'] == '<p>Child test comment</p>\n'
@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
@@ -218,9 +214,7 @@ def test_moderator_delete_comments(support):
comment = get_comment()
support.delete_comment(comment['id'], username='user_two',
moderator=True)
- comment = get_comment()
- assert comment['username'] == '[deleted]'
- assert comment['text'] == '[deleted]'
+ raises(IndexError, get_comment)
@skip_if(sqlalchemy_missing, 'needs sqlalchemy')
@@ -232,14 +226,14 @@ def test_update_username(support):
filter(Comment.username == 'user_two').all()
assert len(comments) == 0
votes = session.query(CommentVote).\
- filter(CommentVote.username == 'user_two')
- assert len(comments) == 0
+ filter(CommentVote.username == 'user_two').all()
+ assert len(votes) == 0
comments = session.query(Comment).\
filter(Comment.username == 'new_user_two').all()
assert len(comments) == 1
votes = session.query(CommentVote).\
- filter(CommentVote.username == 'new_user_two')
- assert len(comments) == 1
+ filter(CommentVote.username == 'new_user_two').all()
+ assert len(votes) == 0
called = False
@@ -257,15 +251,15 @@ def test_moderation(support):
session.close()
accepted = support.add_comment('Accepted Comment', node_id=node.id,
displayed=False)
- rejected = support.add_comment('Rejected comment', node_id=node.id,
+ deleted = support.add_comment('Comment to delete', node_id=node.id,
displayed=False)
# Make sure the moderation_callback is called.
assert called == True
# Make sure the user must be a moderator.
raises(UserNotAuthorizedError, support.accept_comment, accepted['id'])
- raises(UserNotAuthorizedError, support.reject_comment, accepted['id'])
+ raises(UserNotAuthorizedError, support.delete_comment, deleted['id'])
support.accept_comment(accepted['id'], moderator=True)
- support.reject_comment(rejected['id'], moderator=True)
+ support.delete_comment(deleted['id'], moderator=True)
comments = support.get_data(node.id)['comments']
assert len(comments) == 1
comments = support.get_data(node.id, moderator=True)['comments']