diff options
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' \ |