On Jul 26, 6:06 pm, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> One approach that may be worth considering is to look at whether you
> actually need to put contrib.authin INSTALLED APPS. If you're just
> using some of the backend utilities - such as the authentication
> backends - you may not need to sync theauthapplication itself.

I'm having a similar issue, but perhaps more subtle?
We are using contrib.auth to do most of the work, so it needs to be an
INSTALLED_APPS, but we use a custom backend to authenticate to a 3rd
party server.  This causes most of the auth tests to fail because they
assume (reasonably) that authentication is performed against the
auth_user data loaded from the fixture.
To solve this, I created a new setting, TESTING, and added the
following lines to my settings.py:

    TESTING = True
    AUTHENTICATION_BACKENDS = ('my.apps.auth.aashe.MyAuthBackend',)
    if TESTING:
        AUTHENTICATION_BACKENDS = AUTHENTICATION_BACKENDS +
('django.contrib.auth.backends.ModelBackend',)

In this way, when the custom backend fails to authenticate, the
default ModelBackend is consulted and the tests pass.  Then I added
additional tests specifically for our custom authentication backend.
Hoping this helps others.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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