From 88e4a3a3d932997aabebba772217f954df2fd65b Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Tue, 30 Jul 2013 16:14:53 +0200 Subject: [PATCH] [1.6.x] Fixed a test that could fail depending on PASSWORD_HASHERS. Thanks Claude. Refs #20760. Backport of 5b47a9c5a0dcb513dc5ff68b617b3aa374c90f3b from master. --- django/contrib/auth/tests/test_auth_backends.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django/contrib/auth/tests/test_auth_backends.py b/django/contrib/auth/tests/test_auth_backends.py index b48df91cfb..4e83d786cf 100644 --- a/django/contrib/auth/tests/test_auth_backends.py +++ b/django/contrib/auth/tests/test_auth_backends.py @@ -125,6 +125,10 @@ class BaseModelBackendTest(object): @override_settings(PASSWORD_HASHERS=('django.contrib.auth.tests.test_auth_backends.CountingMD5PasswordHasher',)) def test_authentication_timing(self): """Hasher is run once regardless of whether the user exists. Refs #20760.""" + # Re-set the password, because this tests overrides PASSWORD_HASHERS + self.user.set_password('test') + self.user.save() + CountingMD5PasswordHasher.calls = 0 username = getattr(self.user, self.UserModel.USERNAME_FIELD) authenticate(username=username, password='test')