def test_should_validate_values_within_short_code_regex(self): constraint = ShortCodeRegexConstraint("^[a-zA-Z0-9]+$") with self.assertRaises(ShortCodeRegexMismatchException): constraint.validate('shortCode#')
def test_should_return_lower_case_value_if_short_code_is_upper_case(self): constraint = ShortCodeRegexConstraint("^[a-zA-Z0-9]+$") self.assertEquals('shortcode', constraint.validate('SHORTCODE'))
def test_should_validate_values_within_short_code_regex(self): constraint = ShortCodeRegexConstraint("^[a-zA-Z0-9]+$") self.assertEquals('shortCode', constraint.validate('shortCode1'))