Ticket #10521: 10112-remote_users_test.diff

File 10112-remote_users_test.diff, 1.1 KB (added by Kegan Gan, 16 years ago)

Propose new patch. Include mock urls and views into test file.

  • django/contrib/auth/tests/remote_user.py

    diff --git a/django/contrib/auth/tests/remote_user.py b/django/contrib/auth/tests/remote_user.py
    index 449216d..fcba24a 100644
    a b  
    11from datetime import datetime
    22
    33from django.conf import settings
     4from django.conf.urls.defaults import patterns
    45from django.contrib.auth.backends import RemoteUserBackend
    56from django.contrib.auth.models import AnonymousUser, User
     7from django.http import HttpResponse
     8from django.shortcuts import render_to_response
     9from django.template import Template, RequestContext
    610from django.test import TestCase
    711
    812
     13def remote_user_auth_view(request):
     14    t = Template("Username is {{ user }}.")
     15    c = RequestContext(request, {})
     16    return HttpResponse(t.render(c))
     17
     18urlpatterns = patterns('',
     19    (r'^$', remote_user_auth_view),
     20)
     21
    922class RemoteUserTest(TestCase):
    1023
     24    urls = 'django.contrib.auth.tests.remote_user'
    1125    middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
    1226    backend = 'django.contrib.auth.backends.RemoteUserBackend'
    1327
Back to Top