#20916: Provide a "simple_login" feature for the test client
-----------------------------------+--------------------
     Reporter:  mjtamlyn           |      Owner:  nobody
         Type:  New feature        |     Status:  new
    Component:  Testing framework  |    Version:  master
     Severity:  Normal             |   Keywords:  auth
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 At present `client.login()` takes the normal authentication parameters,
 runs them through the authentication backends and then logs the user in. A
 lot of my sites currently require the user to be logged in on every page.
 Consequently, every unit test which uses the client to check a page
 creates a user and then logs them in. When I create the user with a helper
 factory, I have to be careful to record the raw password of that user so I
 can pass it back through the hashing algorithms.

 I'd like to provide `client.simple_login(user)`, which simply sets up the
 test client's session so that the user in question is logged in, without
 going through the hashing algorithms. This would include most of the
 business logic from the current `login()` method, but without the
 `authenticate()` check. This would be a minor performance improvement
 which probably doesn't justify itself in most cases, the main benefit is
 ease-of-use.

 Related in a way to #15179

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20916>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.4779084ba4699f2bfba5967f32a40ea7%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to