naming of a new test client method for logging in

93 views
Skip to first unread message

Tim Graham

unread,
Jun 30, 2015, 9:38:51 AM6/30/15
to django-d...@googlegroups.com
There's a proposal [1] to add a new method to the test client that works like login(), but skips the authentication (no credentials need to be provided) and verification (is_active=False can login) steps. The signature is (user, backend=None). What would you name this method?

Proposals so far:
* force_login() (since this method bypasses authentication and other checks login() has)
* login_user() (since this method takes a user argument instead of credentials)

[1] https://github.com/django/django/pull/4865

Andriy Sokolovskiy

unread,
Jun 30, 2015, 9:41:37 AM6/30/15
to django-d...@googlegroups.com
force_login() seems to be more clear what it going on inside
> --
> You received this message because you are subscribed to the Google
> Groups "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-develop...@googlegroups.com
> <mailto:django-develop...@googlegroups.com>.
> To post to this group, send email to django-d...@googlegroups.com
> <mailto:django-d...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/896e32fc-67ea-4c56-ac90-b8e47a00c7ea%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/896e32fc-67ea-4c56-ac90-b8e47a00c7ea%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Markus Holtermann

unread,
Jun 30, 2015, 12:21:21 PM6/30/15
to django-d...@googlegroups.com
I second Andriy's comment.

/Markus
>To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
>To post to this group, send email to django-d...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/55929C72.3060008%40asokolovskiy.com.
>For more options, visit https://groups.google.com/d/optout.

--

Berker Peksağ

unread,
Jun 30, 2015, 4:34:11 PM6/30/15
to django-d...@googlegroups.com
On Tue, Jun 30, 2015 at 4:38 PM, Tim Graham <timog...@gmail.com> wrote:
> There's a proposal [1] to add a new method to the test client that works
> like login(), but skips the authentication (no credentials need to be
> provided) and verification (is_active=False can login) steps. The signature
> is (user, backend=None). What would you name this method?
>
> Proposals so far:
> * force_login() (since this method bypasses authentication and other checks
> login() has)

+1 for force_login()

--Berker

Tim Graham

unread,
Jul 1, 2015, 1:26:35 PM7/1/15
to django-d...@googlegroups.com
Okay, it seems I'm in the minority with my preference for login_user(). I've committed the patch with force_login(). Thanks for the feedback.
Reply all
Reply to author
Forward
0 new messages