diff options
author | Jacob Mason <jacoblmason@gmail.com> | 2010-08-05 14:13:50 -0500 |
---|---|---|
committer | Jacob Mason <jacoblmason@gmail.com> | 2010-08-05 14:13:50 -0500 |
commit | d0e272e61f34364f5cf9345363d5680f041fdf8f (patch) | |
tree | c7fe7dae082f913f55a9b1e51be4dc4639a3c139 /tests/test_websupport.py | |
parent | 790715d37b1247a606437392a65711187885b34a (diff) | |
download | sphinx-git-d0e272e61f34364f5cf9345363d5680f041fdf8f.tar.gz |
Add comment moderation backend
Diffstat (limited to 'tests/test_websupport.py')
-rw-r--r-- | tests/test_websupport.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_websupport.py b/tests/test_websupport.py index d0956916d..e9c68cf63 100644 --- a/tests/test_websupport.py +++ b/tests/test_websupport.py @@ -194,6 +194,7 @@ def test_moderator_delete_comments(support): assert comment['username'] == '[deleted]' assert comment['text'] == '[deleted]' + @with_support() def test_update_username(support): support.update_username('user_two', 'new_user_two') @@ -212,6 +213,28 @@ def test_update_username(support): assert len(comments) == 1 +called = False +def moderation_callback(comment): + global called + called = True + + +@with_support(moderation_callback=moderation_callback) +def test_moderation(support): + accepted = support.add_comment('Accepted Comment', node_id=3, + displayed=False) + rejected = support.add_comment('Rejected comment', node_id=3, + displayed=False) + # Make sure the moderation_callback is called. + assert called == True + support.accept_comment(accepted['id']) + support.reject_comment(rejected['id']) + comments = support.get_data(3)['comments'] + assert len(comments) == 1 + comments = support.get_data(3, moderator=True)['comments'] + assert len(comments) == 1 + + def test_differ(): differ = CombinedHtmlDiff() source = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\n' \ |