Recently I came across a nice article written by Naftuli, a freelancer at totpal describing the need of writing mocks to test your services.  The blog clearly explains how to develop mocks and stubs using mock library introduced in Python 3.3 (http://www.python.org/dev/peps/pep-0417/). Advantages of using this approach for testing are enormous.

You can read more about it on toptal’s blog. Refer this link: https://www.toptal.com/python/an-introduction-to-mocking-in-python