Ticket #16789: t16789-with-docs-and-tests.diff
File t16789-with-docs-and-tests.diff, 7.3 KB (added by , 13 years ago) |
---|
-
django/contrib/auth/tests/__init__.py
diff --git a/django/contrib/auth/tests/__init__.py b/django/contrib/auth/tests/__init__.py index 143b19c..d4e30cc 100644
a b from django.contrib.auth.tests.management import GetDefaultUsernameTestCase 13 13 from django.contrib.auth.tests.models import ProfileTestCase 14 14 from django.contrib.auth.tests.signals import SignalTestCase 15 15 from django.contrib.auth.tests.tokens import TokenGeneratorTest 16 from django.contrib.auth.tests.views import ( PasswordResetTest,16 from django.contrib.auth.tests.views import (AuthViewNamedURLTests, PasswordResetTest, 17 17 ChangePasswordTest, LoginTest, LogoutTest, LoginURLSettings) 18 18 19 19 # The password for the fixture data users is 'password' -
django/contrib/auth/tests/views.py
diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py index feca899..6e208f5 100644
a b from django.core import mail 13 13 from django.core.urlresolvers import reverse 14 14 from django.http import QueryDict 15 15 16 16 17 class AuthViewsTestCase(TestCase): 17 18 """ 18 19 Helper base class for all the follow test cases. … … class AuthViewsTestCase(TestCase): 45 46 self.assertTrue(response['Location'].endswith(settings.LOGIN_REDIRECT_URL)) 46 47 self.assertTrue(SESSION_KEY in self.client.session) 47 48 49 50 class AuthViewNamedURLTests(AuthViewsTestCase): 51 urls = 'django.contrib.auth.urls' 52 53 def test_named_urls(self): 54 "Named URLs should be reversible" 55 expected_named_urls = [ 56 ('login', [], {}), 57 ('logout', [], {}), 58 ('password_change', [], {}), 59 ('password_change_done', [], {}), 60 ('password_reset', [], {}), 61 ('password_reset_done', [], {}), 62 ('password_reset_confirm', [], { 63 'uidb36': 'aaaaaaa', 64 'token': '1111-aaaaa', 65 }), 66 ('password_reset_complete', [], {}), 67 ] 68 for name, args, kwargs in expected_named_urls: 69 self.assert_(reverse(name, args=args, kwargs=kwargs)) 70 71 48 72 class PasswordResetTest(AuthViewsTestCase): 49 73 50 74 def test_email_not_found(self): -
django/contrib/auth/urls.py
diff --git a/django/contrib/auth/urls.py b/django/contrib/auth/urls.py index 42b4e8f..b32b796 100644
a b 1 # These URLs are normally mapped to /admin/urls.py. This URLs file is 2 # provided as a convenience to those who want to deploy these URLs elsewhere. 1 # This URLs file is provided as a convenience to those who want to deploy these URLs elsewhere. 3 2 # This file is also used to provide a reliable view deployment for test purposes. 4 3 5 from django.conf.urls.defaults import *4 from django.conf.urls.defaults import patterns, url 6 5 7 6 urlpatterns = patterns('', 8 (r'^login/$', 'django.contrib.auth.views.login'),9 (r'^logout/$', 'django.contrib.auth.views.logout'),10 (r'^password_change/$', 'django.contrib.auth.views.password_change'),11 (r'^password_change/done/$', 'django.contrib.auth.views.password_change_done'),12 (r'^password_reset/$', 'django.contrib.auth.views.password_reset'),13 (r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),14 (r'^reset/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm'),15 (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'),7 url(r'^login/$', 'django.contrib.auth.views.login', name='login'), 8 url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout'), 9 url(r'^password_change/$', 'django.contrib.auth.views.password_change', name='password_change'), 10 url(r'^password_change/done/$', 'django.contrib.auth.views.password_change_done', name='password_change_done'), 11 url(r'^password_reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'), 12 url(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'), 13 url(r'^reset/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'), 14 url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete', name='password_reset_complete'), 16 15 ) 17 -
docs/topics/auth.txt
diff --git a/docs/topics/auth.txt b/docs/topics/auth.txt index 69f6fd7..08673fa 100644
a b The login_required decorator 823 823 824 824 .. function:: views.login(request, [template_name, redirect_field_name, authentication_form]) 825 825 826 **URL name:** ``login`` 827 828 See :doc:`the URL documentation </topics/http/urls>` for details on using named URL patterns 829 826 830 Here's what ``django.contrib.auth.views.login`` does: 827 831 828 832 * If called via ``GET``, it displays a login form that POSTs to the … … includes a few other useful built-in views located in 938 942 939 943 Logs a user out. 940 944 945 **URL name:** ``logout`` 946 947 See :doc:`the URL documentation </topics/http/urls>` for details on using named URL patterns 948 949 941 950 **Optional arguments:** 942 951 943 952 * ``next_page``: The URL to redirect to after logout. … … includes a few other useful built-in views located in 970 979 971 980 Logs a user out, then redirects to the login page. 972 981 982 **URL name:** No default URL provided 983 973 984 **Optional arguments:** 974 985 975 986 * ``login_url``: The URL of the login page to redirect to. … … includes a few other useful built-in views located in 979 990 980 991 Allows a user to change their password. 981 992 993 **URL name:** ``password_change`` 994 982 995 **Optional arguments:** 983 996 984 997 * ``template_name``: The full name of a template to use for … … includes a few other useful built-in views located in 1003 1016 1004 1017 The page shown after a user has changed their password. 1005 1018 1019 **URL name:** ``password_change_done`` 1020 1006 1021 **Optional arguments:** 1007 1022 1008 1023 * ``template_name``: The full name of a template to use. … … includes a few other useful built-in views located in 1024 1039 will not be able to request a password reset to prevent misuse 1025 1040 when using an external authentication source like LDAP. 1026 1041 1042 **URL name:** ``password_reset`` 1043 1027 1044 **Optional arguments:** 1028 1045 1029 1046 * ``template_name``: The full name of a template to use for … … includes a few other useful built-in views located in 1099 1116 password. This view is called by default if the :func:`password_reset` view 1100 1117 doesn't have an explicit ``post_reset_redirect`` URL set. 1101 1118 1119 **URL name:** ``password_reset_done`` 1120 1102 1121 **Optional arguments:** 1103 1122 1104 1123 * ``template_name``: The full name of a template to use. … … includes a few other useful built-in views located in 1109 1128 1110 1129 Presents a form for entering a new password. 1111 1130 1131 **URL name:** ``password_reset_confirm`` 1132 1112 1133 **Optional arguments:** 1113 1134 1114 1135 * ``uidb36``: The user's id encoded in base 36. Defaults to ``None``. … … includes a few other useful built-in views located in 1142 1163 Presents a view which informs the user that the password has been 1143 1164 successfully changed. 1144 1165 1166 **URL name:** ``password_reset_complete`` 1167 1145 1168 **Optional arguments:** 1146 1169 1147 1170 * ``template_name``: The full name of a template to display the view.