Open adrpp opened 2 months ago
I've added some more tests/examples in https://github.com/taverntesting/tavern/pull/938 for this, it should work - I'm guessing it's not your actual data but in the example you've posted it's probably because you're missing the complexListElement
element and it should be:
response:
status_code: 200
json:
responseBodyList:
- attribute: "{tavern.request_vars.json.requestBodyList[0].complexListElement.attribute}"
I don't know if there is a way this could be made more obvious to the end user though, it should already print what format vars are available if you have debug logging turned on
Hi @michaelboulton,
sorry for the response delay in first place :) In meanwhile I've refactored the code to call custom callable to flatten the response object, so I had to refactor it back to be able to confirm that what you've written works well too :)
thanks for the support
Hello,
having a request consisting of top-level object holding a list, how do I refer to such list element in response validation using
"{tavern.request_vars}"
?tavern version: 2.11.0
example:
Output (with the syntax above, e.g. "{tavern.request_vars.json.requestBodyList[0].attribute}" ):
Tested the other notation mentioned in docs,
thing.nested.0
, gives String.Formatter error, as mentioned in docs, this got most probably deprecated up from 1.0 version, e.g.Didn't find an example for this in the docs, besides of https://tavern.readthedocs.io/en/latest/basics.html#response -> "thing.nested[0]" , however this applies to
save
keyword/section.Is there known way how to achieve list slicing while using
tavern.request_vars
in theresponse.json
section ?Thanks for any hint, Regards, Adrian