Closed callumgare closed 6 months ago
After continuing to investigate I've figured out that the hooks.py
name seems to be arbitrary and what matters is that it's saved into a python file that is imported when using the cli via the env var SCHEMATHESIS_HOOKS=api.tests.name_of_hooks_file
. I worked that out by stumping upon this page which has this code snippet here which told me this is the right page to find out more info about hooks config required for setting auth, and then this section for showing how it's imported when using the CLI.
Making that clear in the auth page would be super helpful for noobs like me just getting started. Ta! :)
Thank you for opening this issue @callumgare !
I am going to clarify these points and add some more direct usage examples + references on the pages that mention hooks.
Feel free to reach out if you need any further assistance
Brilliant! Thanks for that 😊
Is your feature request related to a problem? Please describe
I'm trying to get stated with schemathesis and after installing the module the first thing I need to do in order to be able to use it with our API is configure auth. However when reading the auth doco it mentions the need to put a code snippet in "the hooks.py" file but makes no further reference of what this file is or where it should go (https://schemathesis.readthedocs.io/en/stable/auth.html#using-in-cli).
I've tried searching for more info but at least after a few minutes of searching it's still not obvious to me: https://schemathesis.readthedocs.io/en/stable/search.html?q=hooks.py&check_keywords=yes&area=default
Describe the solution you'd like
It might be obvious to someone already familiar with the project what hooks.py is and where it lives so I thought it might be useful for me to mention that it's not so clear to someone fresh. Ideally the doco with provide more details on that.
Additional context
Thanks for a fantastic project! Look forward to getting it working and using it for our testing needs :)