Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10521 closed (fixed)

Test failure of missing url '/' in test django.contrib.auth.tests.remote_user.py

Reported by: kegan Owned by: ramiro
Component: contrib.auth Version:
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Running tests for django.contrib.auth (>python manage test auth) failed with "TemplateDoesNotExist: 404.html" errors.

Tested in trunk revision 10069.

File django/contrib/auth/tests/remote_users.py were added in trunk revision 10063.

Attachments (3)

10521-remote-user-tests-enh.diff (18.9 KB) - added by ramiro 5 years ago.
Patch that allows django.contrib.auth tests to run w/o errors from a project when using manage.py and the auth app is in INSTALLED_APPS
10112-remote_users_test.diff (1.1 KB) - added by kegan 5 years ago.
Propose new patch. Include mock urls and views into test file.
handlers.diff (471 bytes) - added by fractal 5 years ago.
adding handlers to import

Download all attachments as: .zip

Change History (14)

comment:1 follow-ups: Changed 5 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

You aren't supposed to run Django test suite tests using manage.py

Closing as invalid because running tests/runtests.py auth --verbosity=2 with an appropiate settings file shows the tests added in r10069 are run and don't generate error.

comment:2 in reply to: ↑ 1 Changed 5 years ago by kegan

  • Resolution invalid deleted
  • Status changed from closed to reopened

I included django.contrib.auth in INSTALLED_APPS (settings.py of my project). When I run "./manage test", it inevitably run django.contrib.auth testcases (and testcases for all the other installed apps). This have been fine for all django.contrib apps ... since prior 1.0. Now, I get errors for django.contrib.auth.

Should I never run "./manage test" by itself, and must always specify app explicity?

Replying to ramiro:

You aren't supposed to run Django test suite tests using manage.py

Closing as invalid because running tests/runtests.py auth --verbosity=2 with an appropiate settings file shows the tests added in r10069 are run and don't generate error.

Changed 5 years ago by ramiro

Patch that allows django.contrib.auth tests to run w/o errors from a project when using manage.py and the auth app is in INSTALLED_APPS

comment:3 Changed 5 years ago by ramiro

  • Has patch set

The attached patch implements changes to the new tests so they run successfully not only as part of the Django test suite but also when the auth app is in INSTALLED_APPS and manage.py test is used in a project.

Something the patch can't express (but could be implemented with a svn mv instead) is that the django/contrib/auth/tests/views.py gets renamed to django/contrib/auth/tests/views_tests.py.

comment:4 Changed 5 years ago by Koen Biermans <koen.biermans@…>

  • Triage Stage changed from Unreviewed to Accepted

The current test also fails when the '/' view in the project uses inherited templates, causing response.context to be a list which leads to a 'TypeError: list indices must be integers' error.

The approach in ramiro's patch seems like the right way to go here.

Changed 5 years ago by kegan

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

comment:5 Changed 5 years ago by kegan

Propose new patch 10112-remote_users_test.diff.

This patch does not affect django/contrib/auth/tests/views.py, as compare to the previous patch.

comment:6 Changed 5 years ago by ramiro

  • Owner changed from nobody to ramiro
  • Status changed from reopened to new

comment:7 Changed 5 years ago by gsong

Kegan's patch also fixes the case where the root URL of a project redirects, or if it doesn't exist at all.

comment:8 Changed 5 years ago by russellm

  • milestone set to 1.1

comment:9 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [10674]) Fixed #10521 -- Modified the Remote User tests so that it isn't dependent on particular deployed URLs. Thanks to Kegan and Ramiro Morales for their contributions.

Changed 5 years ago by fractal

adding handlers to import

comment:10 in reply to: ↑ 1 Changed 5 years ago by matt@…

Replying to ramiro:

You aren't supposed to run Django test suite tests using manage.py

Closing as invalid because running tests/runtests.py auth --verbosity=2 with an appropiate settings file shows the tests added in r10069 are run and don't generate error.

I quoth the documentation:


Running tests
Once you've written tests, run them using your project's manage.py utility:

$ ./manage.py test

So, do we run tests in this manner or not?

comment:11 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.