M
M
maxclax2015-06-23 18:57:04
Django
maxclax, 2015-06-23 18:57:04

How to authorize user PY.TEST?

Tell me this moment:
I have a step in the script: Given я авторизованный пользователь
To solve the step, it is enough to go to the authorization page with a splinter, fill in the fields with data and submit the form. But such tactics take a lot of time during the passage of tests. I want to make authorization directly as a fixture. And this is where it hit a dead end. Tell me how to do it? For tests I use py.test, django 1.8.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vov Vov, 2015-06-24
@balamut108

from django.contrib import auth
auth.authenticate(username=username, password=password)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question