You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functions used in the verify_response_with block in the response block take the response as the first argument. Functions used anywhere else should take no arguments. This might be changed in future to be less confusing.
On the other hand, extra_kwargs in the request block works as expected and the same as in the response block.
Version: Tavern 2.0.6
- name: send a dummy headerrequest:
url: http://httpbin.org/headersmethod: GETheaders:
$ext:
function: utils:generate_messageextra_kwargs: # kwargs can be used!person: Mike
fromboximportBoxdefgenerate_message(person: "John"):
headers= {
"Dummy-Person-Header": person
}
returnBox(headers)
This is just bad wording in the documentation, it basically just means that if your function expects extra args it won't work unless you explicitly put the arguments in extra_args or extra_kwargs. Will fix the documentation
The document says external functions used in a request block should not take arguments.
https://tavern.readthedocs.io/en/latest/basics.html?highlight=external%20function#using-external-functions-for-other-things
On the other hand,
extra_kwargs
in the request block works as expected and the same as in the response block.2.0.6
(Full contents are in https://gist.github.com/Syuparn/34e26705e67a2240c1a2abfa119d8554)
Is this an expected use? Which does
This might be changed in future to be less confusing.
mean,2.0.6
they canor
2.0.6
functions can handle arguments but this is deprecated and the feature will be removed?
The text was updated successfully, but these errors were encountered: