diff -r 5ff1fc726848 -r c6bca38c1cbf parts/django/tests/regressiontests/forms/localflavor/fi.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parts/django/tests/regressiontests/forms/localflavor/fi.py Sat Jan 08 11:20:57 2011 +0530 @@ -0,0 +1,382 @@ +from django.contrib.localflavor.fi.forms import (FIZipCodeField, + FISocialSecurityNumber, FIMunicipalitySelect) + +from utils import LocalFlavorTestCase + + +class FILocalFlavorTests(LocalFlavorTestCase): + def test_FIMunicipalitySelect(self): + f = FIMunicipalitySelect() + out = u'''''' + self.assertEquals(f.render('municipalities', 'turku'), out) + + def test_FIZipCodeField(self): + error_format = [u'Enter a zip code in the format XXXXX.'] + valid = { + '20540': '20540', + '20101': '20101', + } + invalid = { + '20s40': error_format, + '205401': error_format + } + self.assertFieldOutput(FIZipCodeField, valid, invalid) + + def test_FISocialSecurityNumber(self): + error_invalid = [u'Enter a valid Finnish social security number.'] + valid = { + '010101-0101': '010101-0101', + '010101+0101': '010101+0101', + '010101A0101': '010101A0101', + } + invalid = { + '101010-0102': error_invalid, + '10a010-0101': error_invalid, + '101010-0\xe401': error_invalid, + '101010b0101': error_invalid, + } + self.assertFieldOutput(FISocialSecurityNumber, valid, invalid) +