2010/3/24 Filip Gruszczyński <grusz...@gmail.com>:
> When I run all tests, tests for django.contrib.auth. I tried googling
> it and found information, that django.contrib.sites is required, but I
> have this app installed. I was also advised to use
> TEMPLATE_CONTEXT_LOADERS, but this didn't help. Have anyone
> encountered this problem and know, how to solve this?
>
> ======================================================================
> ERROR: test_known_user
> (django.contrib.auth.tests.remote_user.RemoteUserCustomTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>  File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py",
> line 160, in test_known_user
>    super(RemoteUserCustomTest, self).test_known_user()
>  File "/usr/lib/pymodules/python2.6/django/contrib/auth/tests/remote_user.py",
> line 67, in test_known_user
>    self.assertEqual(response.context['user'].username, 'knownuser')
> TypeError: 'NoneType' object is unsubscriptable

It looks like something is going awry with the test client. A couple
of thoughts:

 - Is there any possibility you have a Django 1.0 (or earlier)
checkout somewhere on your path?
 - Is there anywhere in your test suite where you are enabling or
disabling DEBUG?
 - Are you doing anything interesting with template rendering?

If you're interested in digging into this yourself - the auth tests
are using the test client; when you start a test run, Django uses
test.utils.setup_test_environment() to monkeypatch the template module
with an instrumented version. This instrumented test renderer emits
signals whenever a template is rendered, and the test client adds a
listener on this signal (test.client.store_rendered_templates()). The
test client gathers the data emitted by this signal and stores it as
response.context.

response.context will be None (and therefore unscriptable) if the
listener is never fired. This either means that the signal wasn't
installed, the signal wasn't sent (probably because a template wasn't
rendered), or the signal isn't hitting the listener. I'm not sure
which of these is happening for you, but hopefully this gives you
enough detail to work out what is going on.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to