i have a test in tavern
test_name: Add products for tests
stages:
- name: Add product one
request:
url: http://localhost:5566/product
json:
title: Product One
description: Product One in our catalog
picture: images/product.jpeg
categories:
- title: tshirt
- title: casual
price:
currency: EUR
units: 59
method: POST
headers:
content-type: application/json
response:
status_code: 200
headers:
content-type: application/json
save:
json:
product_id: uuid
delay_after: 1
- name: Get product one
request:
url: http://localhost:5566/product/{product_id}
method: GET
headers:
content-type: application/json
response:
status_code: 200
json:
picture: images/product.jpeg
title: Product One
headers:
content-type: application/json
the first stage is a POST that add the Product to the database the second stage is a GET with the uuid that is coming, as variable, from the first stage.
I want to check the response of the second stage and only two specific parameters. the picture and the title of the product
but i get the following error
ERROR tavern.response.base:base.py:41 Structure of returned data was different than expected - Extra keys in response: {'uuid', 'id', 'price_id', 'description'} (expected = '{'picture': 'images/product.jpeg', 'title': 'Product One'}' (type = <class 'dict'>), actual = '{'id': '1', 'uuid': '62c8c26d-c2c8-42a2-9111-2fd3186b08de', 'title': 'Product One', 'description': 'Product One in our catalog', 'picture': 'images/product.jpeg', 'price_id': '1'}' (type = <class 'dict'>))
is possible to define only a set of parameters or is mandatory to use the entire JSON structure?
thanks in advance