from django.contrib.localflavor.ru.forms import * from utils import LocalFlavorTestCase class RULocalFlavorTests(LocalFlavorTestCase): def test_RUPassportNumberField(self): error = [u'Enter a passport number in the format XXXX XXXXXX.'] valid = { '1981 211204': '1981 211204', '0305 967876': '0305 967876', } invalid = { '1981 2112044': error, '1981 23220': error, '9981211201': error, } self.assertFieldOutput(RUPassportNumberField, valid, invalid) def test_RUAlienPassportNumberField(self): error = [u'Enter a passport number in the format XX XXXXXXX.'] valid = { '19 8111204': '19 8111204', '03 0567876': '03 0567876', } invalid = { '198 1112044': error, '19 81123220': error, '99 812112': error, } self.assertFieldOutput(RUAlienPassportNumberField, valid, invalid) def test_RUPostalCodeField(self): error = [u'Enter a postal code in the format XXXXXX.'] valid = { '987654': '987654', '123456': '123456' } invalid = { '123 34': error, '1234567': error, '12345': error } self.assertFieldOutput(RUPostalCodeField, valid, invalid) def test_RUCountySelect(self): f = RUCountySelect() out = u'''''' self.assertEqual(f.render('county', None), out) def test_RURegionSelect(self): f = RURegionSelect() out = u'''''' self.assertEqual(f.render('region', '67'), out)