1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #17499 -- Ensured assertFieldOutput works for fields that customize the "required" error message. Thanks dpifke for the report and patch, and claudep for the tests.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17345 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Aymeric Augustin
2012-01-07 10:26:29 +00:00
parent 4629668ffa
commit 56b37bf1cf
2 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
from __future__ import with_statement, absolute_import
from django.forms import EmailField
from django.forms import EmailField, IntegerField
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.utils.unittest import skip
@@ -149,6 +149,12 @@ class AssertFieldOutputTests(SimpleTestCase):
self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'Wrong output'}, {'aaa': error_invalid})
self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': [u'Come on, gimme some well formatted data, dude.']})
def test_custom_required_message(self):
class MyCustomField(IntegerField):
default_error_messages = {
'required': u'This is really required.',
}
self.assertFieldOutput(MyCustomField, {}, {}, empty_value=None)
__test__ = {"API_TEST": r"""
# Some checks of the doctest output normalizer.