Opened 4 years ago

Closed 4 years ago

#16413 closed Bug (fixed)

changing settings.LOGIN_URL to end with something different than /login/, causes an error in testing your app

Reported by: haras Owned by: nobody
Component: contrib.auth Version: master
Severity: Release blocker Keywords:
Cc: djangoproject.com@…, bjornkri@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

Try changing settings.LOGIN_URL to end with something different than /login/ for example to signup or /admin/ (as it is in my case). You'll get an error in testing your app (django.contrib.auth.tests.views.ChangePasswordTest)

Attachments (1)

16413.diff (648 bytes) - added by aaugustin 4 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 years ago by aaugustin

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

This doesn't happen when you run the test suite because runtests.py sets settings.LOGIN_URL = '/accounts/login/' (line 119). Changing it causes 12 test failures.

The 6 failures in modeltests and the 5 failures inregressiontests don't matter, because these tests are only supposed to be run by runtests.py.

The failure in django.contrib.auth.tests does, because this test may be run by ./manage.py test, and then the value of settings.LOGIN_URL won't be enforced.

Changed 4 years ago by aaugustin

comment:2 Changed 4 years ago by julien

  • Patch needs improvement set

I agree that only auth's tests need fixing. However, the tests would be more robust if they explicitly overrode the LOGIN_URL setting.

comment:3 Changed 4 years ago by aaugustin

#16517 was a duplicate.

comment:4 Changed 4 years ago by bjornkri

  • Cc bjornkri@… added

comment:5 Changed 4 years ago by jezdez

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

In [16552]:

Fixed #16413 -- Stopped an auth test from failing if LOGIN_URL is set to a non-default value. Thanks, Aymeric Augustin.

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