1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #15837. Consolidated all the locaflavor tests into a single, logical, place (regressiontests/localflavor/).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16680 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Julien Phalip
2011-08-24 12:30:59 +00:00
parent ec1226b83f
commit a3fd9cf288
87 changed files with 483 additions and 554 deletions

View File

@@ -0,0 +1,30 @@
from django.contrib.localflavor.gb.forms import GBPostcodeField
from django.test import SimpleTestCase
class GBLocalFlavorTests(SimpleTestCase):
def test_GBPostcodeField(self):
error_invalid = [u'Enter a valid postcode.']
valid = {
'BT32 4PX': 'BT32 4PX',
'GIR 0AA': 'GIR 0AA',
'BT324PX': 'BT32 4PX',
' so11aa ': 'SO1 1AA',
' so1 1aa ': 'SO1 1AA',
'G2 3wt': 'G2 3WT',
'EC1A 1BB': 'EC1A 1BB',
'Ec1a1BB': 'EC1A 1BB',
}
invalid = {
'1NV 4L1D': error_invalid,
'1NV4L1D': error_invalid,
' b0gUS': error_invalid,
}
self.assertFieldOutput(GBPostcodeField, valid, invalid)
valid = {}
invalid = {
'1NV 4L1D': [u'Enter a bloody postcode!'],
}
kwargs = {'error_messages': {'invalid': 'Enter a bloody postcode!'}}
self.assertFieldOutput(GBPostcodeField, valid, invalid, field_kwargs=kwargs)