Opened 5 years ago

Closed 5 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: Matt Harasymczuk 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 Aymeric Augustin 5 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 5 years ago by Aymeric Augustin

Has patch: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

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 5 years ago by Aymeric Augustin

Attachment: 16413.diff added

comment:2 Changed 5 years ago by Julien Phalip

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 5 years ago by Aymeric Augustin

#16517 was a duplicate.

comment:4 Changed 5 years ago by Bjorn Kristinsson

Cc: bjornkri@… added

comment:5 Changed 5 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

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