Scenario:
- Our CLI-script downloads data
- Therefore, amongst other things such as pre/postprocessing, it calls a function from another (internal) python package (which is maintained by another group)
- The internal python package finally executes a request to an (internal) web server
In order to test the download-data function we could mock three different things:
- nothing, i.e. actually download data from the server.
- the executed request (by intercepting it).
- the function from the other python package
Obviously, the first choice is the most comprehensive test, but it can easily fail due to external factors (changes/errors in python package or not running webserver). The last choice is the most "robust" one in the sense that it really only tests the CLI-script. So there are PROs and CONs to each choice.