diff -r 5ff1fc726848 -r c6bca38c1cbf parts/django/tests/regressiontests/forms/localflavor/it.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parts/django/tests/regressiontests/forms/localflavor/it.py Sat Jan 08 11:20:57 2011 +0530 @@ -0,0 +1,70 @@ +from django.contrib.localflavor.it.forms import (ITZipCodeField, ITRegionSelect, + ITSocialSecurityNumberField, ITVatNumberField) + +from utils import LocalFlavorTestCase + + +class ITLocalFlavorTests(LocalFlavorTestCase): + def test_ITRegionSelect(self): + f = ITRegionSelect() + out = u'''''' + self.assertEqual(f.render('regions', 'PMN'), out) + + def test_ITZipCodeField(self): + error_invalid = [u'Enter a valid zip code.'] + valid = { + '00100': '00100', + } + invalid = { + ' 00100': error_invalid, + } + self.assertFieldOutput(ITZipCodeField, valid, invalid) + + def test_ITSocialSecurityNumberField(self): + error_invalid = [u'Enter a valid Social Security number.'] + valid = { + 'LVSGDU99T71H501L': 'LVSGDU99T71H501L', + 'LBRRME11A01L736W': 'LBRRME11A01L736W', + 'lbrrme11a01l736w': 'LBRRME11A01L736W', + 'LBR RME 11A01 L736W': 'LBRRME11A01L736W', + } + invalid = { + 'LBRRME11A01L736A': error_invalid, + '%BRRME11A01L736W': error_invalid, + } + self.assertFieldOutput(ITSocialSecurityNumberField, valid, invalid) + + def test_ITVatNumberField(self): + error_invalid = [u'Enter a valid VAT number.'] + valid = { + '07973780013': '07973780013', + '7973780013': '07973780013', + 7973780013: '07973780013', + } + invalid = { + '07973780014': error_invalid, + 'A7973780013': error_invalid, + } + self.assertFieldOutput(ITVatNumberField, valid, invalid) +