How to mock external dependencies to improve your tests in Python
Unit tests typically only test parts of your program in isolation from other units or modules. Some folks like to not mock anything and setup any dependencies before the tests and use them. But what if you're depending on a third party API outside of your control? What if the API you're using is not available at the time? Sometimes you have no choice but to mock the API. In this post, I'll show you how to mock external dependencies so you can make your tests runnable in any condition even without the API itself.