Robert Lehmann avatar Robert Lehmann committed bd9edab Merge

merge

Comments (0)

Files changed (2)

sphinx/themes/basic/static/websupport.js

     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();

tests/test_websupport.py

     # 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
 from util import *
 
 
-raise SkipTest('websupport tests are currently not working')
-
 default_settings = {'builddir': os.path.join(test_root, 'websupport'),
                     'status': StringIO(),
                     'warning': StringIO()}
     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')
     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')
         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
     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']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.