Opened 15 years ago

Closed 14 years ago

Last modified 12 years ago

#10976 closed (fixed)

missing template files for correctly executing test cases on django.contrib.auth

Reported by: aarond10 Owned by: Chris Beaven
Component: Testing framework Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This has taken me a while to wrap my head around. I hope I have it right.

When the test cases for django.contrib.auth run, they reassign settings.TEMPLATE_DIRS to use a local set of templates. This works fine for login purposes but the password reset pages don't exist in the current SVN repository so application paths are searched and if password_reset_email.html can be found elsewhere, its loaded and rendered. Unfortunately, since the test cases also use their own URLs, any references to named {% url %} tags in password_reset_email.html lead to NoReverseMatch exceptions.

Could someone please put some basic templates in the contrib/auth/tests/templates/ folder to avoid these errors?

Attachments (1)

10976.diff (2.9 KB ) - added by Chris Beaven 15 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by aarond10, 15 years ago

Sorry, I havent had time to put these in patch format but the changes are trivial.

django/contrib/auth/tests/views.py:

Remove the setUp() and tearDown() functions in the PasswordResetTest class.

django/contrib/auth/tests/templates/registration/password_reset_form.html

{{ form }}

django/contrib/auth/tests/templates/registration/password_reset_email.html

{{ protocol }}:{{ domain }}/reset/{{ uid }}-{{ token }}/

django/contrib/auth/tests/templates/registration/password_reset_confirm.html

{% if validlink %}

Please enter your new password:
{{ form }}

{% else %}

The password reset link was invalid

{% endif %}

django/contrib/auth/tests/templates/registration/password_reset_done.html
django/contrib/auth/tests/templates/registration/password_reset_complete.html

Empty file will do fine.

comment:2 by Russell Keith-Magee, 15 years ago

milestone: 1.1

comment:3 by Arthur Koziel, 15 years ago

Owner: changed from nobody to Arthur Koziel

comment:4 by Chris Beaven, 15 years ago

Triage Stage: UnreviewedAccepted

by Chris Beaven, 15 years ago

Attachment: 10976.diff added

comment:5 by Chris Beaven, 15 years ago

Has patch: set
milestone: 1.2
Triage Stage: AcceptedReady for checkin

Here's a patch which adds the missing template files (and I verify that this fixes the auth test errors related to overridden template files for me).

#11009 covered fixing just the incomplete duplicate setUp and tearDown methods, so I marked that as a duplicate of this one

comment:6 by Chris Beaven, 15 years ago

Owner: changed from Arthur Koziel to Chris Beaven
Status: newassigned

comment:7 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [12420]) Fixed #10976 -- Isolated contrib.auth tests so they will always pass, regardless of any local templates. Thanks to aarond10 for the report, and SmileyChris for turning that into a patch.

comment:8 by Russell Keith-Magee, 14 years ago

(In [12422]) [1.1.X] Fixed #10976 -- Isolated contrib.auth tests so they will always pass, regardless of any local templates. Thanks to aarond10 for the report, and SmileyChris for turning that into a patch.

Backport of r12420 from trunk.

comment:9 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top