T
T
Temirlan Utegenov2019-07-09 10:16:54
Python
Temirlan Utegenov, 2019-07-09 10:16:54

How to get the token in the header at the beginning of the pytest tests and set it in all the following requests?

We set the task to write small API autotests. (even though I'm a manual jun tester).
Essence:
There is a function In this post-request, I receive a response in the form of a token in the header-e Then I need to pick up this token and insert it into other requests. For example: It is possible to manually set the token for each request, but it will take a lot of time and the desire to do everything right. In postman-e, this problem was solved by obtaining a token in the first request and setting it in the environment
def test_post_tokens
def test_get_account_info

pm.environment.set("token",postman.getResponseHeader("Auth-Token"));

How to do the same in pycharm?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question