Opened 16 years ago

Closed 16 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: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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@…> 16 years ago.

Download all attachments as: .zip

Change History (2)

by Jason Yan <tailofthesun@…>, 16 years ago

Attachment: test-login-url_r6917.diff added

comment:1 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in [6934].

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