Django

Code

Ticket #10521 (closed: fixed)

Opened 1 year ago

Last modified 9 months ago

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

Reported by: kegan Assigned to: ramiro
Milestone: 1.1 Component: Authentication
Version: Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

10521-remote-user-tests-enh.diff (18.9 kB) - added by ramiro on 03/17/09 14:16:33.
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 on 03/21/09 13:22:43.
Propose new patch. Include mock urls and views into test file.
handlers.diff (471 bytes) - added by fractal on 06/08/09 09:10:20.
adding handlers to import

Change History

(follow-ups: ↓ 2 ↓ 10 ) 03/17/09 05:58:19 changed by ramiro

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to invalid.
  • needs_tests changed.
  • needs_docs changed.

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.

(in reply to: ↑ 1 ) 03/17/09 09:17:05 changed by kegan

  • status changed from closed to reopened.
  • resolution deleted.

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.

03/17/09 14:16:33 changed by ramiro

  • attachment 10521-remote-user-tests-enh.diff added.

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

03/17/09 14:23:18 changed by ramiro

  • has_patch set to 1.

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.

03/18/09 04:01:03 changed by Koen Biermans <koen.biermans@werk.belgie.be>

  • 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.

03/21/09 13:22:43 changed by kegan

  • attachment 10112-remote_users_test.diff added.

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

03/21/09 13:31:29 changed 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.

03/30/09 16:44:58 changed by ramiro

  • owner changed from nobody to ramiro.
  • status changed from reopened to new.

04/13/09 11:18:51 changed 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.

05/03/09 09:01:02 changed by russellm

  • milestone set to 1.1.

05/04/09 02:05:45 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(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.

06/08/09 09:10:20 changed by fractal

  • attachment handlers.diff added.

adding handlers to import

(in reply to: ↑ 1 ) 06/30/09 19:43:51 changed by matt@schinckel.net

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?


Add/Change #10521 (Test failure of missing url '/' in test django.contrib.auth.tests.remote_user.py)




Change Properties
Action