Ticket #21379: test_issue21379.diff

File test_issue21379.diff, 1.6 KB (added by jorgecarleitao, 11 years ago)
  • django/contrib/auth/tests/test_forms.py

    diff --git a/django/contrib/auth/tests/test_forms.py b/django/contrib/auth/tests/test_forms.py
    index 0efd5fb..f6876b1 100644
    a b  
     1# coding=utf-8
    12from __future__ import unicode_literals
    23
    34import os
    class UserCreationFormTest(TestCase):  
    4849        self.assertEqual(form["username"].errors,
    4950                         [force_text(form.fields['username'].error_messages['invalid'])])
    5051
     52    def test_invalid_non_ascii_username(self):
     53        data = {
     54            'username': 'jsmithé',
     55            'password1': 'test123',
     56            'password2': 'test123',
     57        }
     58        form = UserCreationForm(data)
     59        self.assertFalse(form.is_valid())
     60        #print(form.fields['username'].error_messages)
     61        self.assertEqual(form["username"].errors,
     62                         [force_text(form.fields['username'].error_messages['invalid'])])
     63
    5164    def test_password_verification(self):
    5265        # The verification password is incorrect.
    5366        data = {
  • django/core/validators.py

    diff --git a/django/core/validators.py b/django/core/validators.py
    index cc71b72..2d4fd85 100644
    a b class RegexValidator(object):  
    4646        Validates that the input matches the regular expression
    4747        if inverse_match is False, otherwise raises ValidationError.
    4848        """
     49        print(self.regex.pattern, self.regex.flags)
    4950        if not (self.inverse_match is not bool(self.regex.search(
    5051                force_text(value)))):
    5152            raise ValidationError(self.message, code=self.code)
Back to Top