There's python mock
pip install mock
Or caliendo
(a buzzfeed skunkswork project) offers some easy-to-use caching for services.
pip install caliendo
There is a lot of good documentation on both.
http://www.voidspace.org.uk/python/mock/
or
http://www.github.com/buzzfeed/caliendo
from caliendo.patch import patch
from caliendo import expected_value
class TestTweepyApi(unittest.TestCase):
@patch('tweepy.api.update_status')
def test_tweet(self):
expected_value.is_equal_to(my_method_that_calls_tweepy_update_status())