web/lib/django/contrib/auth/tests/forms.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/contrib/auth/tests/forms.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/contrib/auth/tests/forms.py	Tue May 25 02:43:45 2010 +0200
@@ -21,7 +21,7 @@
 # The username contains invalid data.
 
 >>> data = {
-...     'username': 'jsmith@example.com',
+...     'username': 'jsmith!',
 ...     'password1': 'test123',
 ...     'password2': 'test123',
 ... }
@@ -29,7 +29,7 @@
 >>> form.is_valid()
 False
 >>> form["username"].errors
-[u'This value must contain only letters, numbers and underscores.']
+[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
 
 # The verification password is incorrect.
 
@@ -65,7 +65,7 @@
 # The success case.
 
 >>> data = {
-...     'username': 'jsmith2',
+...     'username': 'jsmith2@example.com',
 ...     'password1': 'test123',
 ...     'password2': 'test123',
 ... }
@@ -73,7 +73,7 @@
 >>> form.is_valid()
 True
 >>> form.save()
-<User: jsmith2>
+<User: jsmith2@example.com>
 
 # The user submits an invalid username.
 
@@ -189,7 +189,7 @@
 >>> form.is_valid()
 False
 >>> form['username'].errors
-[u'This value must contain only letters, numbers and underscores.']
+[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
 
 
 ### PasswordResetForm
@@ -219,4 +219,13 @@
 >>> form.cleaned_data['email']
 u'jsmith3@example.com'
 
+# bug #5605, preserve the case of the user name (before the @ in the email address)
+# when creating a user.
+>>> user = User.objects.create_user('forms_test2', 'tesT@EXAMple.com', 'test')
+>>> user.email
+'tesT@example.com'
+>>> user = User.objects.create_user('forms_test3', 'tesT', 'test')
+>>> user.email
+'tesT'
+
 """