summaryrefslogtreecommitdiff
path: root/tests/test_websupport.py
diff options
context:
space:
mode:
authorJacob Mason <jacoblmason@gmail.com>2010-08-05 12:20:15 -0500
committerJacob Mason <jacoblmason@gmail.com>2010-08-05 12:20:15 -0500
commit790715d37b1247a606437392a65711187885b34a (patch)
treeb0d05b39c6c4862ca38083eaf1a1490a9e93e2cc /tests/test_websupport.py
parent69a2c07396f94ec0099c24089dd452b30cc06052 (diff)
downloadsphinx-git-790715d37b1247a606437392a65711187885b34a.tar.gz
added update_username method
Diffstat (limited to 'tests/test_websupport.py')
-rw-r--r--tests/test_websupport.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test_websupport.py b/tests/test_websupport.py
index ca64ec2d1..d0956916d 100644
--- a/tests/test_websupport.py
+++ b/tests/test_websupport.py
@@ -16,7 +16,7 @@ from sphinx.websupport import WebSupport
from sphinx.websupport.errors import *
from sphinx.websupport.storage.differ import CombinedHtmlDiff
from sphinx.websupport.storage.sqlalchemystorage import Session, \
- SQLAlchemyStorage
+ SQLAlchemyStorage, Comment, CommentVote
from sphinx.websupport.storage.db import Node
from util import *
@@ -90,7 +90,8 @@ def test_comments(support):
parent_id=str(comment['id']), displayed=False)
# Add a comment to another node to make sure it isn't returned later.
support.add_comment('Second test comment',
- node_id=str(second_node.id))
+ node_id=str(second_node.id),
+ username='user_two')
# Access the comments as a moderator.
data = support.get_data(str(first_node.id), moderator=True)
@@ -193,6 +194,23 @@ 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')
+ session = Session()
+ comments = session.query(Comment).\
+ filter(Comment.username == 'user_two').all()
+ assert len(comments) == 0
+ votes = session.query(CommentVote).\
+ filter(CommentVote.username == 'user_two')
+ assert len(comments) == 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
+
def test_differ():
differ = CombinedHtmlDiff()