Open macagua opened 6 years ago
@svanoort I solved this issue with the curl option curl_option_followlocation: True
and curl_option_maxredirs: 2
like the following code:
# Usage: resttest.py --url http://localhost:8089/ --test ./tests/api/test_cars.yaml
---
- config:
- testset: "Tests App"
- timeout: 60000
- test:
- name: "GET - cars list"
- url: "/api/cars/ARG/2018-2010/SPORT/"
- curl_option_followlocation: True
- curl_option_maxredirs: 2
- headers: {
'Content-Type': 'application/json',
'Authorization': 'apikey 3fdty0dsgd454lrrfsdgv8455safmmkj544wdss3',
'fc-user-id': '09876',
'fc-api-key': 'sdf4534lkjoj4564789kh3423ñlñmkn2232mkpb3'
}
- extract_binds:
- 'id': {'jsonpath_mini': 'objects.id'}
- 'car_code': {'jsonpath_mini': 'objects.cars.0.car.code'}
- 'shash_code': {'jsonpath_mini': 'objects.cars[0].rates[0].shash'}
- expected_status: [200]
- test:
- name: "GET - car_info"
# http://localhost:8089/api/car_info/ARG00OS5?language=en&id=4565609876098702323
- url: {'template': "/api/car_info/$car_code?language=es&id=$id"}
- curl_option_followlocation: True
- curl_option_maxredirs: 2
- headers: {
'Content-Type': 'application/json',
'Authorization': 'apikey 3fdty0dsgd454lrrfsdgv8455safmmkj544wdss3',
'fc-user-id': '09876',
'fc-api-key': 'sdf4534lkjoj4564789kh3423ñlñmkn2232mkpb3'
}
- expected_status: [200]
Seems that you've got this sorted now anyway @macagua, but we've made Tavern specifically to make sequential tests easier. https://github.com/taverntesting/tavern
Hi @svanoort
I trying to make seven secuencial tests from the API Rest that I need to test.
The first test is a Get request that generate a response in Json format, from which I have to extract and resend two or three values to the next test, to attach those values as parameters of the URL of the next Get query and so on...
Here a example of my code:
I execute the following command:
Then the first test show INFO:Test Succeeded
But the second test show the error:
Any idea how I can resolve this error?