== settings.py ==
{{{
DATABASES['default']['ENGINE'] = 'django.db.backends.sqlite3'
DATABASES['default']['NAME'] = 'proj.db'
MIDDLEWARE_CLASSES += (
'django.contrib.auth.middleware.RemoteUserMiddleware',)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.RemoteUserBackend',
'django.contrib.auth.backends.ModelBackend',
)
}}}
== python manage.py test auth.RemoteUserCustomTest ==
{{{
Creating test database for alias 'default'...
FFF.F
======================================================================
FAIL: test_header_disappears
(django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 109, in
test_header_disappears
self.assertEqual(response.context['user'].username, 'knownuser')
AssertionError: 'know...@example.com' != 'knownuser'
======================================================================
FAIL: test_known_user
(django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 188, in
test_known_user
super(RemoteUserCustomTest, self).test_known_user()
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 71, in
test_known_user
self.assertEqual(response.context['user'].username, 'knownuser')
AssertionError: 'know...@example.com' != 'knownuser'
======================================================================
FAIL: test_last_login
(django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 99, in
test_last_login
self.assertEqual(default_login, response.context['user'].last_login)
AssertionError: datetime.datetime(2000, 1, 1, 0, 0, tzinfo=<UTC>) !=
datetime.datetime(2013, 7, 24, 8, 2, 15, 485797, tzinfo=<UTC>)
======================================================================
FAIL: test_unknown_user
(django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 198, in
test_unknown_user
self.assertEqual(newuser.email, 'us...@example.com')
AssertionError: u'' != 'us...@example.com'
----------------------------------------------------------------------
Ran 5 tests in 0.071s
FAILED (failures=4)
Destroying test database for alias 'default'...
}}}
== python manage.py test auth.RemoteUserNoCreateTest ==
{{{
Creating test database for alias 'default'...
....F
======================================================================
FAIL: test_unknown_user
(django.contrib.auth.tests.remote_user.RemoteUserNoCreateTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/virtualenv/proj/lib/python2.7/site-
packages/django/contrib/auth/tests/remote_user.py", line 145, in
test_unknown_user
self.assertTrue(response.context['user'].is_anonymous())
AssertionError: False is not true
----------------------------------------------------------------------
Ran 5 tests in 0.440s
FAILED (failures=1)
Destroying test database for alias 'default'...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20796>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: timograham@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
By listing `'django.contrib.auth.backends.RemoteUserBackend'` in your
settings, it's causing the failing tests to use that backend rather than
`'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'`. We
could fix this by prepending (rather than appending) `self.backend` in the
`setUp` method - that would fix the first set of failures.
However, the failing test in `RemoteUserCustomTest` actually requires
`'django.contrib.auth.backends.RemoteUserBackend'` not to be in
`AUTHENTICATION_BACKENDS` since the user does authenticate against that
backend. I suppose the tests need to be rewritten not to depend on the
values of `settings.AUTHENTICATION_BACKENDS`?
--
Ticket URL: <https://code.djangoproject.com/ticket/20796#comment:1>
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #13394
--
Ticket URL: <https://code.djangoproject.com/ticket/20796#comment:2>