mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #15838 -- Promoted assertFieldOutput to a general test utility. Thanks to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16653 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import with_statement
|
||||
|
||||
from django.forms import EmailField
|
||||
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
|
||||
from django.utils.unittest import skip
|
||||
|
||||
@@ -139,6 +140,16 @@ class AssertRaisesMsgTest(SimpleTestCase):
|
||||
self.assertRaisesMessage(ValueError, "[.*x+]y?", func1)
|
||||
|
||||
|
||||
class AssertFieldOutputTests(SimpleTestCase):
|
||||
|
||||
def test_assert_field_output(self):
|
||||
error_invalid = [u'Enter a valid e-mail address.']
|
||||
self.assertFieldOutput(EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid})
|
||||
self.assertRaises(AssertionError, self.assertFieldOutput, EmailField, {'a@a.com': 'a@a.com'}, {'aaa': error_invalid + [u'Another error']})
|
||||
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.']})
|
||||
|
||||
|
||||
__test__ = {"API_TEST": r"""
|
||||
# Some checks of the doctest output normalizer.
|
||||
# Standard doctests do fairly
|
||||
|
||||
Reference in New Issue
Block a user