Exemplo n.º 1
0
    def test_validate_postcode_empty_cy(self):
        postcode = ''
        locale = 'cy'

        # When validate_postcode is called
        with self.assertRaises(InvalidDataErrorWelsh) as cm:
            AddressValidators.validate_postcode(postcode, locale)
        # Then an InvalidDataError is raised
        self.assertEqual('Rhowch god post', str(cm.exception))
Exemplo n.º 2
0
    def test_validate_postcode_invalid(self):
        postcode = 'ZZ99 9ZZ'
        locale = 'en'

        # When validate_postcode is called
        with self.assertRaises(InvalidDataError) as cm:
            AddressValidators.validate_postcode(postcode, locale)
        # Then an InvalidDataError is raised
        self.assertEqual('Enter a valid UK postcode', str(cm.exception))
Exemplo n.º 3
0
    def test_validate_postcode_not_alphanumeric_cy(self):
        postcode = '?<>:{}'
        locale = 'cy'

        # When validate_postcode is called
        with self.assertRaises(InvalidDataErrorWelsh) as cm:
            AddressValidators.validate_postcode(postcode, locale)
        # Then an InvalidDataError is raised
        self.assertEqual('Rhowch god post dilys yn y Deyrnas Unedig',
                         str(cm.exception))
Exemplo n.º 4
0
    def test_validate_postcode_valid(self):
        postcode = 'PO15 5RR'
        locale = 'en'

        # When validate_postcode is called
        AddressValidators.validate_postcode(postcode, locale)
Exemplo n.º 5
0
    def test_validate_postcode_valid_with_unicode(self):
        postcode = 'BS2 0FW'
        locale = 'en'

        # When validate_postcode is called
        AddressValidators.validate_postcode(postcode, locale)