summaryrefslogtreecommitdiff
path: root/tests/regressiontests/comment_tests
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2011-03-03 15:04:39 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2011-03-03 15:04:39 +0000
commitafd040d4d3a06fe92e3080870b2ff2095ce86a75 (patch)
treebda969614999a3fcfbf1466caa0d75e512dd1374 /tests/regressiontests/comment_tests
parentb7c41c1fbb2d45634dde5f7a450ba1a5aea5a8af (diff)
Updated test assertions that have been deprecated by the move to unittest2. In summary, this means:
assert_ -> assertTrue assertEquals -> assertEqual failUnless -> assertTrue For full details, see http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations git-svn-id: http://code.djangoproject.com/svn/django/trunk@15728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/comment_tests')
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_form_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py12
-rw-r--r--tests/regressiontests/comment_tests/tests/comment_view_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/feed_tests.py4
-rw-r--r--tests/regressiontests/comment_tests/tests/moderation_view_tests.py6
-rw-r--r--tests/regressiontests/comment_tests/tests/templatetag_tests.py10
6 files changed, 22 insertions, 22 deletions
diff --git a/tests/regressiontests/comment_tests/tests/comment_form_tests.py b/tests/regressiontests/comment_tests/tests/comment_form_tests.py
index 5efa5c64a8..57dad3625c 100644
--- a/tests/regressiontests/comment_tests/tests/comment_form_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_form_tests.py
@@ -20,7 +20,7 @@ class CommentFormTests(CommentTestCase):
def testValidPost(self):
a = Article.objects.get(pk=1)
f = CommentForm(a, data=self.getValidData(a))
- self.assert_(f.is_valid(), f.errors)
+ self.assertTrue(f.is_valid(), f.errors)
return f
def tamperWithForm(self, **kwargs):
@@ -65,12 +65,12 @@ class CommentFormTests(CommentTestCase):
def testSecurityErrors(self):
f = self.tamperWithForm(honeypot="I am a robot")
- self.assert_("honeypot" in f.security_errors())
+ self.assertTrue("honeypot" in f.security_errors())
def testGetCommentObject(self):
f = self.testValidPost()
c = f.get_comment_object()
- self.assert_(isinstance(c, Comment))
+ self.assertTrue(isinstance(c, Comment))
self.assertEqual(c.content_object, Article.objects.get(pk=1))
self.assertEqual(c.comment, "This is my comment")
c.save()
diff --git a/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py b/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
index 9728490bc2..4177163f2a 100644
--- a/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_utils_moderators_tests.py
@@ -65,29 +65,29 @@ class CommentUtilsModeratorTests(CommentTestCase):
def testEmailNotification(self):
moderator.register(Entry, EntryModerator1)
self.createSomeComments()
- self.assertEquals(len(mail.outbox), 2)
+ self.assertEqual(len(mail.outbox), 2)
def testCommentsEnabled(self):
moderator.register(Entry, EntryModerator2)
self.createSomeComments()
- self.assertEquals(Comment.objects.all().count(), 1)
+ self.assertEqual(Comment.objects.all().count(), 1)
def testAutoCloseField(self):
moderator.register(Entry, EntryModerator3)
self.createSomeComments()
- self.assertEquals(Comment.objects.all().count(), 0)
+ self.assertEqual(Comment.objects.all().count(), 0)
def testAutoModerateField(self):
moderator.register(Entry, EntryModerator4)
c1, c2 = self.createSomeComments()
- self.assertEquals(c2.is_public, False)
+ self.assertEqual(c2.is_public, False)
def testAutoModerateFieldImmediate(self):
moderator.register(Entry, EntryModerator5)
c1, c2 = self.createSomeComments()
- self.assertEquals(c2.is_public, False)
+ self.assertEqual(c2.is_public, False)
def testAutoCloseFieldImmediate(self):
moderator.register(Entry, EntryModerator6)
c1, c2 = self.createSomeComments()
- self.assertEquals(Comment.objects.all().count(), 0) \ No newline at end of file
+ self.assertEqual(Comment.objects.all().count(), 0) \ No newline at end of file
diff --git a/tests/regressiontests/comment_tests/tests/comment_view_tests.py b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
index 5e791966ae..e3f3bbeff7 100644
--- a/tests/regressiontests/comment_tests/tests/comment_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/comment_view_tests.py
@@ -155,7 +155,7 @@ class CommentViewTests(CommentTestCase):
# callback
def receive(sender, **kwargs):
self.assertEqual(kwargs['comment'].comment, "This is my comment")
- self.assert_('request' in kwargs)
+ self.assertTrue('request' in kwargs)
received_signals.append(kwargs.get('signal'))
# Connect signals and keep track of handled ones
@@ -269,7 +269,7 @@ class CommentViewTests(CommentTestCase):
response = self.client.post("/post/", data)
location = response["Location"]
match = re.search(r"^http://testserver/somewhere/else/\?foo=bar&c=\d+#baz$", location)
- self.failUnless(match != None, "Unexpected redirect location: %s" % location)
+ self.assertTrue(match != None, "Unexpected redirect location: %s" % location)
# Without a query string
a = Article.objects.get(pk=1)
@@ -279,4 +279,4 @@ class CommentViewTests(CommentTestCase):
response = self.client.post("/post/", data)
location = response["Location"]
match = re.search(r"^http://testserver/somewhere/else/\?c=\d+#baz$", location)
- self.failUnless(match != None, "Unexpected redirect location: %s" % location)
+ self.assertTrue(match != None, "Unexpected redirect location: %s" % location)
diff --git a/tests/regressiontests/comment_tests/tests/feed_tests.py b/tests/regressiontests/comment_tests/tests/feed_tests.py
index 0bc6618d9a..f385dcec5a 100644
--- a/tests/regressiontests/comment_tests/tests/feed_tests.py
+++ b/tests/regressiontests/comment_tests/tests/feed_tests.py
@@ -11,8 +11,8 @@ class CommentFeedTests(CommentTestCase):
def test_feed(self):
response = self.client.get(self.feed_url)
- self.assertEquals(response.status_code, 200)
- self.assertEquals(response['Content-Type'], 'application/rss+xml')
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response['Content-Type'], 'application/rss+xml')
self.assertContains(response, '<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">')
self.assertContains(response, '<title>example.com comments</title>')
self.assertContains(response, '<link>http://example.com/</link>')
diff --git a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
index e5094ab0cc..c9be06a340 100644
--- a/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
+++ b/tests/regressiontests/comment_tests/tests/moderation_view_tests.py
@@ -182,14 +182,14 @@ class AdminActionsTests(CommentTestCase):
comments = self.createSomeComments()
self.client.login(username="normaluser", password="normaluser")
response = self.client.get("/admin/comments/comment/")
- self.assertEquals("approve_comments" in response.content, False)
+ self.assertEqual("approve_comments" in response.content, False)
def testActionsModerator(self):
comments = self.createSomeComments()
makeModerator("normaluser")
self.client.login(username="normaluser", password="normaluser")
response = self.client.get("/admin/comments/comment/")
- self.assertEquals("approve_comments" in response.content, True)
+ self.assertEqual("approve_comments" in response.content, True)
def testActionsDisabledDelete(self):
"Tests a CommentAdmin where 'delete_selected' has been disabled."
@@ -197,7 +197,7 @@ class AdminActionsTests(CommentTestCase):
self.client.login(username="normaluser", password="normaluser")
response = self.client.get('/admin2/comments/comment/')
self.assertEqual(response.status_code, 200)
- self.assert_(
+ self.assertTrue(
'<option value="delete_selected">' not in response.content,
"Found an unexpected delete_selected in response"
)
diff --git a/tests/regressiontests/comment_tests/tests/templatetag_tests.py b/tests/regressiontests/comment_tests/tests/templatetag_tests.py
index 29a097a48f..4c90d9d208 100644
--- a/tests/regressiontests/comment_tests/tests/templatetag_tests.py
+++ b/tests/regressiontests/comment_tests/tests/templatetag_tests.py
@@ -20,7 +20,7 @@ class CommentTemplateTagTests(CommentTestCase):
t = "{% load comments %}" + (tag or "{% get_comment_form for comment_tests.article a.id as form %}")
ctx, out = self.render(t, a=Article.objects.get(pk=1))
self.assertEqual(out, "")
- self.assert_(isinstance(ctx["form"], CommentForm))
+ self.assertTrue(isinstance(ctx["form"], CommentForm))
def testGetCommentFormFromLiteral(self):
self.testGetCommentForm("{% get_comment_form for comment_tests.article 1 as form %}")
@@ -31,8 +31,8 @@ class CommentTemplateTagTests(CommentTestCase):
def testRenderCommentForm(self, tag=None):
t = "{% load comments %}" + (tag or "{% render_comment_form for comment_tests.article a.id %}")
ctx, out = self.render(t, a=Article.objects.get(pk=1))
- self.assert_(out.strip().startswith("<form action="))
- self.assert_(out.strip().endswith("</form>"))
+ self.assertTrue(out.strip().startswith("<form action="))
+ self.assertTrue(out.strip().endswith("</form>"))
def testRenderCommentFormFromLiteral(self):
self.testRenderCommentForm("{% render_comment_form for comment_tests.article 1 %}")
@@ -86,8 +86,8 @@ class CommentTemplateTagTests(CommentTestCase):
def testRenderCommentList(self, tag=None):
t = "{% load comments %}" + (tag or "{% render_comment_list for comment_tests.article a.id %}")
ctx, out = self.render(t, a=Article.objects.get(pk=1))
- self.assert_(out.strip().startswith("<dl id=\"comments\">"))
- self.assert_(out.strip().endswith("</dl>"))
+ self.assertTrue(out.strip().startswith("<dl id=\"comments\">"))
+ self.assertTrue(out.strip().endswith("</dl>"))
def testRenderCommentListFromLiteral(self):
self.testRenderCommentList("{% render_comment_list for comment_tests.article 1 %}")