diff -r f69520e5a824 django/contrib/auth/tests/__init__.py
--- a/django/contrib/auth/tests/__init__.py	Tue Mar 17 07:40:04 2009 -0300
+++ b/django/contrib/auth/tests/__init__.py	Tue Mar 17 16:12:25 2009 -0300
@@ -1,5 +1,5 @@
 from django.contrib.auth.tests.basic import BASIC_TESTS
-from django.contrib.auth.tests.views \
+from django.contrib.auth.tests.views_tests \
         import PasswordResetTest, ChangePasswordTest
 from django.contrib.auth.tests.forms import FORM_TESTS
 from django.contrib.auth.tests.remote_user \
diff -r f69520e5a824 django/contrib/auth/tests/remote_user.py
--- a/django/contrib/auth/tests/remote_user.py	Tue Mar 17 07:40:04 2009 -0300
+++ b/django/contrib/auth/tests/remote_user.py	Tue Mar 17 16:12:25 2009 -0300
@@ -14,6 +14,8 @@
     # Usernames to be passed in REMOTE_USER for the test_known_user test case.
     known_user = 'knownuser'
     known_user2 = 'knownuser2'
+
+    urls = 'django.contrib.auth.tests.test_urls'
 
     def setUp(self):
         self.curr_middleware = settings.MIDDLEWARE_CLASSES
@@ -28,15 +30,15 @@
         """
         num_users = User.objects.count()
 
-        response = self.client.get('/')
+        response = self.client.get('/remote_user/')
         self.assert_(isinstance(response.context['user'], AnonymousUser))
         self.assertEqual(User.objects.count(), num_users)
 
-        response = self.client.get('/', REMOTE_USER=None)
+        response = self.client.get('/remote_user/', REMOTE_USER=None)
         self.assert_(isinstance(response.context['user'], AnonymousUser))
         self.assertEqual(User.objects.count(), num_users)
 
-        response = self.client.get('/', REMOTE_USER='')
+        response = self.client.get('/remote_user/', REMOTE_USER='')
         self.assert_(isinstance(response.context['user'], AnonymousUser))
         self.assertEqual(User.objects.count(), num_users)
 
@@ -46,13 +48,13 @@
         as a User.
         """
         num_users = User.objects.count()
-        response = self.client.get('/', REMOTE_USER='newuser')
+        response = self.client.get('/remote_user/', REMOTE_USER='newuser')
         self.assertEqual(response.context['user'].username, 'newuser')
         self.assertEqual(User.objects.count(), num_users + 1)
         User.objects.get(username='newuser')
 
         # Another request with same user should not create any new users.
-        response = self.client.get('/', REMOTE_USER='newuser')
+        response = self.client.get('/remote_user/', REMOTE_USER='newuser')
         self.assertEqual(User.objects.count(), num_users + 1)
 
     def test_known_user(self):
@@ -62,12 +64,12 @@
         User.objects.create(username='knownuser')
         User.objects.create(username='knownuser2')
         num_users = User.objects.count()
-        response = self.client.get('/', REMOTE_USER=self.known_user)
+        response = self.client.get('/remote_user/', REMOTE_USER=self.known_user)
         self.assertEqual(response.context['user'].username, 'knownuser')
         self.assertEqual(User.objects.count(), num_users)
         # Test that a different user passed in the headers causes the new user
         # to be logged in.
-        response = self.client.get('/', REMOTE_USER=self.known_user2)
+        response = self.client.get('/remote_user/', REMOTE_USER=self.known_user2)
         self.assertEqual(response.context['user'].username, 'knownuser2')
         self.assertEqual(User.objects.count(), num_users)
 
@@ -82,13 +84,13 @@
         user.last_login = default_login
         user.save()
 
-        response = self.client.get('/', REMOTE_USER=self.known_user)
+        response = self.client.get('/remote_user/', REMOTE_USER=self.known_user)
         self.assertNotEqual(default_login, response.context['user'].last_login)
 
         user = User.objects.get(username='knownuser')
         user.last_login = default_login
         user.save()
-        response = self.client.get('/', REMOTE_USER=self.known_user)
+        response = self.client.get('/remote_user/', REMOTE_USER=self.known_user)
         self.assertEqual(default_login, response.context['user'].last_login)
 
     def tearDown(self):
@@ -113,7 +115,7 @@
 
     def test_unknown_user(self):
         num_users = User.objects.count()
-        response = self.client.get('/', REMOTE_USER='newuser')
+        response = self.client.get('/remote_user/', REMOTE_USER='newuser')
         self.assert_(isinstance(response.context['user'], AnonymousUser))
         self.assertEqual(User.objects.count(), num_users)
 
diff -r f69520e5a824 django/contrib/auth/tests/test_urls.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/django/contrib/auth/tests/test_urls.py	Tue Mar 17 16:12:25 2009 -0300
@@ -0,0 +1,12 @@
+"""
+
+This is a urlconf to be loaded by remote_user.py. Add any urls needed
+for tests only.
+
+"""
+from django.conf.urls.defaults import *
+from django.contrib.auth.tests.views import remote_user_auth_view
+
+urlpatterns = patterns('',
+                       (r'^remote_user/', remote_user_auth_view),
+                      )
diff -r f69520e5a824 django/contrib/auth/tests/views.py
--- a/django/contrib/auth/tests/views.py	Tue Mar 17 07:40:04 2009 -0300
+++ b/django/contrib/auth/tests/views.py	Tue Mar 17 16:12:25 2009 -0300
@@ -1,164 +1,8 @@
+from django.http import HttpResponse
+from django.shortcuts import render_to_response
+from django.template import Template, RequestContext
 
-import os
-import re
-
-from django.conf import settings
-from django.contrib.auth.models import User
-from django.test import TestCase
-from django.core import mail
-
-class PasswordResetTest(TestCase):
-    fixtures = ['authtestdata.json']
-    urls = 'django.contrib.auth.urls'
-
-    def test_email_not_found(self):
-        "Error is raised if the provided email address isn't currently registered"
-        response = self.client.get('/password_reset/')
-        self.assertEquals(response.status_code, 200)
-        response = self.client.post('/password_reset/', {'email': 'not_a_real_email@email.com'})
-        self.assertContains(response, "That e-mail address doesn&#39;t have an associated user account")
-        self.assertEquals(len(mail.outbox), 0)
-
-    def test_email_found(self):
-        "Email is sent if a valid email address is provided for password reset"
-        response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
-        self.assertEquals(response.status_code, 302)
-        self.assertEquals(len(mail.outbox), 1)
-        self.assert_("http://" in mail.outbox[0].body)
-
-    def _test_confirm_start(self):
-        # Start by creating the email
-        response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
-        self.assertEquals(response.status_code, 302)
-        self.assertEquals(len(mail.outbox), 1)
-        return self._read_signup_email(mail.outbox[0])
-
-    def _read_signup_email(self, email):
-        urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body)
-        self.assert_(urlmatch is not None, "No URL found in sent email")
-        return urlmatch.group(), urlmatch.groups()[0]
-
-    def test_confirm_valid(self):
-        url, path = self._test_confirm_start()
-        response = self.client.get(path)
-        # redirect to a 'complete' page:
-        self.assertEquals(response.status_code, 200)
-        self.assert_("Please enter your new password" in response.content)
-
-    def test_confirm_invalid(self):
-        url, path = self._test_confirm_start()
-        # Lets munge the token in the path, but keep the same length,
-        # in case the URL conf will reject a different length
-        path = path[:-5] + ("0"*4) + path[-1]
-
-        response = self.client.get(path)
-        self.assertEquals(response.status_code, 200)
-        self.assert_("The password reset link was invalid" in response.content)
-
-    def test_confirm_invalid_post(self):
-        # Same as test_confirm_invalid, but trying
-        # to do a POST instead.
-        url, path = self._test_confirm_start()
-        path = path[:-5] + ("0"*4) + path[-1]
-
-        response = self.client.post(path, {'new_password1': 'anewpassword',
-                                           'new_password2':' anewpassword'})
-        # Check the password has not been changed
-        u = User.objects.get(email='staffmember@example.com')
-        self.assert_(not u.check_password("anewpassword"))
-
-    def test_confirm_complete(self):
-        url, path = self._test_confirm_start()
-        response = self.client.post(path, {'new_password1': 'anewpassword',
-                                           'new_password2': 'anewpassword'})
-        # It redirects us to a 'complete' page:
-        self.assertEquals(response.status_code, 302)
-        # Check the password has been changed
-        u = User.objects.get(email='staffmember@example.com')
-        self.assert_(u.check_password("anewpassword"))
-
-        # Check we can't use the link again
-        response = self.client.get(path)
-        self.assertEquals(response.status_code, 200)
-        self.assert_("The password reset link was invalid" in response.content)
-
-    def test_confirm_different_passwords(self):
-        url, path = self._test_confirm_start()
-        response = self.client.post(path, {'new_password1': 'anewpassword',
-                                           'new_password2':' x'})
-        self.assertEquals(response.status_code, 200)
-        self.assert_("The two password fields didn&#39;t match" in response.content)
-
-
-class ChangePasswordTest(TestCase):
-    fixtures = ['authtestdata.json']
-    urls = 'django.contrib.auth.urls'
-
-    def setUp(self):
-        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
-        settings.TEMPLATE_DIRS = (
-            os.path.join(
-                os.path.dirname(__file__),
-                'templates'
-            )
-        ,)
-
-    def tearDown(self):
-        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
-
-    def login(self, password='password'):
-        response = self.client.post('/login/', {
-            'username': 'testclient',
-            'password': password
-            }
-        )
-        self.assertEquals(response.status_code, 302)
-        self.assert_(response['Location'].endswith(settings.LOGIN_REDIRECT_URL))
-
-    def fail_login(self, password='password'):
-        response = self.client.post('/login/', {
-            'username': 'testclient',
-            'password': password
-            }
-        )
-        self.assertEquals(response.status_code, 200)
-        self.assert_("Please enter a correct username and password. Note that both fields are case-sensitive." in response.content)
-
-    def logout(self):
-        response = self.client.get('/logout/')
-
-    def test_password_change_fails_with_invalid_old_password(self):
-        self.login()
-        response = self.client.post('/password_change/', {
-            'old_password': 'donuts',
-            'new_password1': 'password1',
-            'new_password2': 'password1',
-            }
-        )
-        self.assertEquals(response.status_code, 200)
-        self.assert_("Your old password was entered incorrectly. Please enter it again." in response.content)
-
-    def test_password_change_fails_with_mismatched_passwords(self):
-        self.login()
-        response = self.client.post('/password_change/', {
-            'old_password': 'password',
-            'new_password1': 'password1',
-            'new_password2': 'donuts',
-            }
-        )
-        self.assertEquals(response.status_code, 200)
-        self.assert_("The two password fields didn&#39;t match." in response.content)
-
-    def test_password_change_succeeds(self):
-        self.login()
-        response = self.client.post('/password_change/', {
-            'old_password': 'password',
-            'new_password1': 'password1',
-            'new_password2': 'password1',
-            }
-        )
-        self.assertEquals(response.status_code, 302)
-        self.assert_(response['Location'].endswith('/password_change/done/'))
-        self.fail_login()
-        self.login(password='password1')
-
+def remote_user_auth_view(request):
+    t = Template("Username is {{ user }}.")
+    c = RequestContext(request, {})
+    return HttpResponse(t.render(c))
diff -r f69520e5a824 django/contrib/auth/tests/views_tests.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/django/contrib/auth/tests/views_tests.py	Tue Mar 17 16:12:25 2009 -0300
@@ -0,0 +1,164 @@
+
+import os
+import re
+
+from django.conf import settings
+from django.contrib.auth.models import User
+from django.test import TestCase
+from django.core import mail
+
+class PasswordResetTest(TestCase):
+    fixtures = ['authtestdata.json']
+    urls = 'django.contrib.auth.urls'
+
+    def test_email_not_found(self):
+        "Error is raised if the provided email address isn't currently registered"
+        response = self.client.get('/password_reset/')
+        self.assertEquals(response.status_code, 200)
+        response = self.client.post('/password_reset/', {'email': 'not_a_real_email@email.com'})
+        self.assertContains(response, "That e-mail address doesn&#39;t have an associated user account")
+        self.assertEquals(len(mail.outbox), 0)
+
+    def test_email_found(self):
+        "Email is sent if a valid email address is provided for password reset"
+        response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
+        self.assertEquals(response.status_code, 302)
+        self.assertEquals(len(mail.outbox), 1)
+        self.assert_("http://" in mail.outbox[0].body)
+
+    def _test_confirm_start(self):
+        # Start by creating the email
+        response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
+        self.assertEquals(response.status_code, 302)
+        self.assertEquals(len(mail.outbox), 1)
+        return self._read_signup_email(mail.outbox[0])
+
+    def _read_signup_email(self, email):
+        urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body)
+        self.assert_(urlmatch is not None, "No URL found in sent email")
+        return urlmatch.group(), urlmatch.groups()[0]
+
+    def test_confirm_valid(self):
+        url, path = self._test_confirm_start()
+        response = self.client.get(path)
+        # redirect to a 'complete' page:
+        self.assertEquals(response.status_code, 200)
+        self.assert_("Please enter your new password" in response.content)
+
+    def test_confirm_invalid(self):
+        url, path = self._test_confirm_start()
+        # Lets munge the token in the path, but keep the same length,
+        # in case the URL conf will reject a different length
+        path = path[:-5] + ("0"*4) + path[-1]
+
+        response = self.client.get(path)
+        self.assertEquals(response.status_code, 200)
+        self.assert_("The password reset link was invalid" in response.content)
+
+    def test_confirm_invalid_post(self):
+        # Same as test_confirm_invalid, but trying
+        # to do a POST instead.
+        url, path = self._test_confirm_start()
+        path = path[:-5] + ("0"*4) + path[-1]
+
+        response = self.client.post(path, {'new_password1': 'anewpassword',
+                                           'new_password2':' anewpassword'})
+        # Check the password has not been changed
+        u = User.objects.get(email='staffmember@example.com')
+        self.assert_(not u.check_password("anewpassword"))
+
+    def test_confirm_complete(self):
+        url, path = self._test_confirm_start()
+        response = self.client.post(path, {'new_password1': 'anewpassword',
+                                           'new_password2': 'anewpassword'})
+        # It redirects us to a 'complete' page:
+        self.assertEquals(response.status_code, 302)
+        # Check the password has been changed
+        u = User.objects.get(email='staffmember@example.com')
+        self.assert_(u.check_password("anewpassword"))
+
+        # Check we can't use the link again
+        response = self.client.get(path)
+        self.assertEquals(response.status_code, 200)
+        self.assert_("The password reset link was invalid" in response.content)
+
+    def test_confirm_different_passwords(self):
+        url, path = self._test_confirm_start()
+        response = self.client.post(path, {'new_password1': 'anewpassword',
+                                           'new_password2':' x'})
+        self.assertEquals(response.status_code, 200)
+        self.assert_("The two password fields didn&#39;t match" in response.content)
+
+
+class ChangePasswordTest(TestCase):
+    fixtures = ['authtestdata.json']
+    urls = 'django.contrib.auth.urls'
+
+    def setUp(self):
+        self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
+        settings.TEMPLATE_DIRS = (
+            os.path.join(
+                os.path.dirname(__file__),
+                'templates'
+            )
+        ,)
+
+    def tearDown(self):
+        settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS
+
+    def login(self, password='password'):
+        response = self.client.post('/login/', {
+            'username': 'testclient',
+            'password': password
+            }
+        )
+        self.assertEquals(response.status_code, 302)
+        self.assert_(response['Location'].endswith(settings.LOGIN_REDIRECT_URL))
+
+    def fail_login(self, password='password'):
+        response = self.client.post('/login/', {
+            'username': 'testclient',
+            'password': password
+            }
+        )
+        self.assertEquals(response.status_code, 200)
+        self.assert_("Please enter a correct username and password. Note that both fields are case-sensitive." in response.content)
+
+    def logout(self):
+        response = self.client.get('/logout/')
+
+    def test_password_change_fails_with_invalid_old_password(self):
+        self.login()
+        response = self.client.post('/password_change/', {
+            'old_password': 'donuts',
+            'new_password1': 'password1',
+            'new_password2': 'password1',
+            }
+        )
+        self.assertEquals(response.status_code, 200)
+        self.assert_("Your old password was entered incorrectly. Please enter it again." in response.content)
+
+    def test_password_change_fails_with_mismatched_passwords(self):
+        self.login()
+        response = self.client.post('/password_change/', {
+            'old_password': 'password',
+            'new_password1': 'password1',
+            'new_password2': 'donuts',
+            }
+        )
+        self.assertEquals(response.status_code, 200)
+        self.assert_("The two password fields didn&#39;t match." in response.content)
+
+    def test_password_change_succeeds(self):
+        self.login()
+        response = self.client.post('/password_change/', {
+            'old_password': 'password',
+            'new_password1': 'password1',
+            'new_password2': 'password1',
+            }
+        )
+        self.assertEquals(response.status_code, 302)
+        self.assert_(response['Location'].endswith('/password_change/done/'))
+        self.fail_login()
+        self.login(password='password1')
+
