How to install nose-blockage
- Download and install ActivePython
- Open Command Prompt
pypm install nose-blockage
An experimental nose plugin to block access to external services that you really should not be accessing in your unit tests.
pip install nose-blockage
Then add the following to your tests:
By default it whitelists localhost and 127.0.0.1. To change the whitelist:
If the code hits a http connection then instead of completing it will raise a MockHTTPCall exception. Please go and mock your tests appropriately.
By default it whitelists no domains. To change the whitelist:
It will raise a MockSMTPCall exception.