http://kushal76uaid62oup5774umh654scnu5dwzh4u2534qxhcbi4wbab3ad.onion/posts/michael-foords-python-mock-for-testing.html
Example: import unittest
import xmlrpclib
from mock import patch
class TestFoo(unittest.TestCase):
"""
A simple test
"""
@patch('xmlrpclib.Server')
def test_first(self, mock_xmlrpc):
m = mock_xmlrpc.return_value
m.multiply.return_value = 6
server = xmlrpclib.Server("http://kushaldas.in/")
res = server.multiply(2, 3)
self.assertEqual(res, 6)
if __name__ == '__main__':
unittest.main() In Fedora you can just yum...