summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2007-09-04 00:48:19 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2007-09-04 00:48:19 +0000
commit1da7b5cde720337026f5c3650be5d26d9d326949 (patch)
treea0e6b7fca1f982f59277827822820063f2323a1f
parentd1d4d018bf170dca2758f59e8063d171f40889f5 (diff)
Added test for unknown non-field error.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/regressiontests/test_client_regress/models.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/regressiontests/test_client_regress/models.py b/tests/regressiontests/test_client_regress/models.py
index 6ec093e8a5..a15e4f15ec 100644
--- a/tests/regressiontests/test_client_regress/models.py
+++ b/tests/regressiontests/test_client_regress/models.py
@@ -211,6 +211,27 @@ class AssertFormErrorTests(TestCase):
self.assertFormError(response, 'form', 'email', 'Some error.')
except AssertionError, e:
self.assertEqual(str(e), "The field 'email' on form 'form' in context 0 does not contain the error 'Some error.' (actual errors: [u'Enter a valid e-mail address.'])")
+
+ def test_unknown_nonfield_error(self):
+ """
+ Checks that an assertion is raised if the form's non field errors
+ doesn't contain the provided error.
+ """
+ post_data = {
+ 'text': 'Hello World',
+ 'email': 'not an email address',
+ 'value': 37,
+ 'single': 'b',
+ 'multi': ('b','c','e')
+ }
+ response = self.client.post('/test_client/form_view/', post_data)
+ self.assertEqual(response.status_code, 200)
+ self.assertTemplateUsed(response, "Invalid POST Template")
+
+ try:
+ self.assertFormError(response, 'form', None, 'Some error.')
+ except AssertionError, e:
+ self.assertEqual(str(e), "The form 'form' in context 0 does not contain the non-field error 'Some error.' (actual errors: )")
class FileUploadTests(TestCase):
def test_simple_upload(self):