Beispiel #1
0
    def test_raises_error_for_whitespace(self):
        """Test an ACN can be valid when it contains whitespace."""

        # NB: Form field should strip the whitespace before regex validation is run.
        invalid_acn = '604 327 504'
        validator = AUCompanyNumberFieldValidator()
        self.assertRaises(ValidationError, lambda: validator(invalid_acn))
Beispiel #2
0
    def test_raises_error_for_invalid_acn(self):
        """Test that an ACN must pass the ATO's validation algorithm."""

        invalid_acn = '604327509'
        validator = AUCompanyNumberFieldValidator()
        self.assertRaises(ValidationError, lambda: validator(invalid_acn))
Beispiel #3
0
    def test_raises_error_for_acn_containing_a_letter(self):
        """Test an ACN containing a letter is invalid."""

        invalid_acn = '60432750A'
        validator = AUCompanyNumberFieldValidator()
        self.assertRaises(ValidationError, lambda: validator(invalid_acn))
Beispiel #4
0
    def test_raises_error_for_too_long_acn(self):
        """Test an ACN with more than nine digits is invalid."""

        invalid_acn = '6043275040'
        validator = AUCompanyNumberFieldValidator()
        self.assertRaises(ValidationError, lambda: validator(invalid_acn))
Beispiel #5
0
    def test_no_error_for_a_valid_acn(self):
        """Test a valid ACN does not cause an error."""

        valid_acn = '604327504'
        validator = AUCompanyNumberFieldValidator()
        validator(valid_acn)