Added test cases for change [5739].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ef080e44d0
commit
6a4f164a6f
|
@ -10,12 +10,23 @@ class AssertContainsTests(TestCase):
|
||||||
def test_contains(self):
|
def test_contains(self):
|
||||||
"Responses can be inspected for content, including counting repeated substrings"
|
"Responses can be inspected for content, including counting repeated substrings"
|
||||||
response = self.client.get('/test_client_regress/no_template_view/')
|
response = self.client.get('/test_client_regress/no_template_view/')
|
||||||
|
|
||||||
|
self.assertContains(response, 'never', 0)
|
||||||
self.assertContains(response, 'once')
|
self.assertContains(response, 'once')
|
||||||
self.assertContains(response, 'once', 1)
|
self.assertContains(response, 'once', 1)
|
||||||
self.assertContains(response, 'twice')
|
self.assertContains(response, 'twice')
|
||||||
self.assertContains(response, 'twice', 2)
|
self.assertContains(response, 'twice', 2)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.assertContains(response, 'never', 1)
|
||||||
|
except AssertionError, e:
|
||||||
|
self.assertEquals(str(e), "Found 0 instances of 'never' in response (expected 1)")
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.assertContains(response, 'once', 0)
|
||||||
|
except AssertionError, e:
|
||||||
|
self.assertEquals(str(e), "Found 1 instances of 'once' in response (expected 0)")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.assertContains(response, 'once', 2)
|
self.assertContains(response, 'once', 2)
|
||||||
except AssertionError, e:
|
except AssertionError, e:
|
||||||
|
|
Loading…
Reference in New Issue