summaryrefslogtreecommitdiff
path: root/tests/regressiontests/comment_tests
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-08-26 18:53:52 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-08-26 18:53:52 +0000
commit378f5ddb5acb919525002fd92ff249f103ea8f31 (patch)
treefe1eba8fe0b912a7d374859d264551fd84bff764 /tests/regressiontests/comment_tests
parentc6a2bd9b962af1cdf46f964589e6023046cfa8ec (diff)
Updated comment signals to provide enough information to actually act on. This was uncovered when working on the documentation, which'll be committed shortly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8589 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/comment_tests')
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_view_tests.py11
-rw-r--r--tests/regressiontests/comment_tests/tests/moderation_view_tests.py5
2 files changed, 7 insertions, 9 deletions
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
index 87f5fd372b..ac7a1d4a5e 100644
--- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
@@ -102,10 +102,8 @@ class CommentViewTests(CommentTestCase):
# callback
def receive(sender, **kwargs):
- self.assertEqual(sender.comment, "This is my comment")
- # TODO: Get the two commented tests below to work.
-# self.assertEqual(form_data["comment"], "This is my comment")
-# self.assertEqual(request.method, "POST")
+ self.assertEqual(kwargs['comment'].comment, "This is my comment")
+ self.assert_('request' in kwargs)
received_signals.append(kwargs.get('signal'))
# Connect signals and keep track of handled ones
@@ -117,7 +115,7 @@ class CommentViewTests(CommentTestCase):
# Post a comment and check the signals
self.testCreateValidComment()
self.assertEqual(received_signals, excepted_signals)
-
+
def testWillBePostedSignal(self):
"""
Test that the comment_will_be_posted signal can prevent the comment from
@@ -137,7 +135,8 @@ class CommentViewTests(CommentTestCase):
it gets posted
"""
def receive(sender, **kwargs):
- sender.is_public = False # a bad but effective spam filter :)...
+ # a bad but effective spam filter :)...
+ kwargs['comment'].is_public = False
signals.comment_will_be_posted.connect(receive)
self.testCreateValidComment()
diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
index e5ebbb935f..2f6b51d709 100644
--- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
@@ -48,9 +48,8 @@ class FlagViewTests(CommentTestCase):
# callback
def receive(sender, **kwargs):
- flag = sender.flags.get(id=1)
- self.assertEqual(flag.flag, CommentFlag.SUGGEST_REMOVAL)
- self.assertEqual(flag.user.username, "normaluser")
+ self.assertEqual(kwargs['flag'].flag, CommentFlag.SUGGEST_REMOVAL)
+ self.assertEqual(kwargs['request'].user.username, "normaluser")
received_signals.append(kwargs.get('signal'))
# Connect signals and keep track of handled ones