Code

Opened 6 years ago

Closed 6 years ago

#6200 closed (fixed)

Unit tests fail if provided settings use a different LOGIN_URL

Reported by: Jason Yan <tailofthesun@…> Owned by: nobody
Component: Testing framework Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using a value different from the default value for LOGIN_URL causes model tests to fail.

======================================================================
FAIL: Request a logout after logging in
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 315, in test_logout
    self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/login_protected_view/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?next=/test_client/login_protected_view/', expected 'http://testserver/accounts/login/?next=/test_client/login_protected_view/'

======================================================================
FAIL: Request a page that is protected with @login_required
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 245, in test_view_with_login
    self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/login_protected_view/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?next=/test_client/login_protected_view/', expected 'http://testserver/accounts/login/?next=/test_client/login_protected_view/'

======================================================================
FAIL: Request a page that is protected with @login_required(redirect_field_name='redirect_to')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 277, in test_view_with_login_and_custom_redirect
    self.assertRedirects(response, 'http://testserver/accounts/login/?redirect_to=/test_client/login_protected_view_custom_redirect/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?redirect_to=/test_client/login_protected_view_custom_redirect/', expected 'http://testserver/accounts/login/?redirect_to=/test_client/login_protected_view_custom_redirect/'

======================================================================
FAIL: Request a page that is protected with a @login_required method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 261, in test_view_with_method_login
    self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/login_protected_method_view/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?next=/test_client/login_protected_method_view/', expected 'http://testserver/accounts/login/?next=/test_client/login_protected_method_view/'

======================================================================
FAIL: Request a page that is protected with a @permission_required method
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 339, in test_view_with_method_permissions
    self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/permission_protected_method_view/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?next=/test_client/permission_protected_method_view/', expected 'http://testserver/accounts/login/?next=/test_client/permission_protected_method_view/'

======================================================================
FAIL: Request a page that is protected with @permission_required
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/jason/Projects/django-svn-trunk/tests/modeltests/test_client/models.py", line 322, in test_view_with_permissions
    self.assertRedirects(response, 'http://testserver/accounts/login/?next=/test_client/permission_protected_view/')
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/testcases.py", line 94, in assertRedirects
    "Response redirected to '%s', expected '%s'" % (url, expected_url))
AssertionError: Response redirected to 'http://dev:8000/login/?next=/test_client/permission_protected_view/', expected 'http://testserver/accounts/login/?next=/test_client/permission_protected_view/'

}}}

Attachments (1)

test-login-url_r6917.diff (1.1 KB) - added by Jason Yan <tailofthesun@…> 6 years ago.

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by Jason Yan <tailofthesun@…>

comment:1 Changed 6 years ago by mtredinnick

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

Fixed in [6934].

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.