【发布时间】:2009-12-05 02:18:28
【问题描述】:
在 Django 中,当我运行“manage.py test”时,我遇到了很多与身份验证相关的失败。一些例子:
FAIL: test_password_change_succeeds -- AssertionError 200 != 302
FAIL: Logout without next_page option renders the default template -- AssertionError 200 != 302
还有:
Failed example:
form.non_field_errors()
Expected:
[u'This account is inactive.']
Got:
[u'Please enter correct username and password....']
我已经配置了 settings.py 以便 Django 接受来自 Apache2 的身份验证。在设置中,MIDDLEWARE_CLASSES 包含“AuthenticationMiddleware”和“RemoteUserMiddleware”,AUTHENTICATION_BACKENDS 包含“RemoteUserBackend”。
我如何找出这里的问题?
更新 2 我通过注释掉 AUTHENTICATION_BACKENDS 的设置来清除测试错误。现在我必须考虑我在测试环境中需要的身份验证状态,但至少我已经清除了这个问题。
第一次更新提到了一个我已经删除的问题。
【问题讨论】:
-
哪个版本的django?有时在主干中有损坏的测试。
标签: django unit-testing