Django

Code

Ticket #6200 (closed: fixed)

Opened 5 months ago

Last modified 5 months ago

Unit tests fail if provided settings use a different LOGIN_URL

Reported by: Jason Yan <tailofthesun@gmail.com> Assigned to: nobody
Component: Unit test system Version: SVN
Keywords: Cc:
Triage Stage: Unreviewed Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

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

test-login-url_r6917.diff (1.1 kB) - added by Jason Yan <tailofthesun@gmail.com> on 12/13/07 03:03:09.

Change History

12/13/07 03:03:09 changed by Jason Yan <tailofthesun@gmail.com>

  • attachment test-login-url_r6917.diff added.

12/17/07 04:31:47 changed by mtredinnick

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

Fixed in [6934].


Add/Change #6200 (Unit tests fail if provided settings use a different LOGIN_URL)




Change Properties
Action