mirror of
https://github.com/django/django.git
synced 2024-12-24 01:55:49 +00:00
Fixed #13509 -- Modified the comment tests so that signal cleanup doesn't rely on garbage collection. Thanks to Alex Gaynor for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13204 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
819f43f499
commit
861baecd84
@ -174,12 +174,13 @@ class CommentViewTests(CommentTestCase):
|
|||||||
actually getting saved
|
actually getting saved
|
||||||
"""
|
"""
|
||||||
def receive(sender, **kwargs): return False
|
def receive(sender, **kwargs): return False
|
||||||
signals.comment_will_be_posted.connect(receive)
|
signals.comment_will_be_posted.connect(receive, dispatch_uid="comment-test")
|
||||||
a = Article.objects.get(pk=1)
|
a = Article.objects.get(pk=1)
|
||||||
data = self.getValidData(a)
|
data = self.getValidData(a)
|
||||||
response = self.client.post("/post/", data)
|
response = self.client.post("/post/", data)
|
||||||
self.assertEqual(response.status_code, 400)
|
self.assertEqual(response.status_code, 400)
|
||||||
self.assertEqual(Comment.objects.count(), 0)
|
self.assertEqual(Comment.objects.count(), 0)
|
||||||
|
signals.comment_will_be_posted.disconnect(dispatch_uid="comment-test")
|
||||||
|
|
||||||
def testWillBePostedSignalModifyComment(self):
|
def testWillBePostedSignalModifyComment(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user