我有一个问题,获取与Django(1.2.3-3 + squeeze1)一起发送的django.contrib.auth单元测试一旦AUTHENTICATION_BACKENDS设置。还有其他的帖子,如Unit testing with remote authentication和How to Unit test with different settings in Django?关于修复,但我的测试仍然失败,这些建议。Django.contrib.auth单元测试失败,并启用AUTHENTICATION_BACKENDS
我试着将下面的内容添加到我的SetUP()和TearDown()方法来解决这个问题。
from django.conf import settings
def setUp(self):
self.old_backend = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = None
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.old_backend
任何人有任何其他建议,以解决这个问题吗?提前致谢。
这里是追溯的粘贴。 http://pastebin.com/xX4dmuzr