#18157: Document that setting PASSWORD_HASHERS for tests can make them much 
faster
-------------------------------+------------------------------------
     Reporter:  carljm         |                    Owner:  nobody
         Type:  New feature    |                   Status:  closed
    Component:  Documentation  |                  Version:  1.4
     Severity:  Normal         |               Resolution:  fixed
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by jodym@…):

 Note that you CAN'T do this for just one test using @override_settings,
 because PREFERRED_HASHER is initialized once the first time get_hasher()
 is called.  Ugh.

 Workaround:
 {{{
 @override_settings(PASSWORD_HASHERS=(
     'django.contrib.auth.hashers.SHA1PasswordHasher',
     'django.contrib.auth.hashers.BCryptPasswordHasher',
 ))
 def test_whatever(self):
     import django.contrib.auth.hashers
     django.contrib.auth.hashers.PREFERRED_HASHER = None

     ...
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18157#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

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

Reply via email to