Here are the examples of the python api mocket.mocket.Mocket.enable taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
def setUp(self):
mocket.Mocket.enable()
assertSocket(
expected='CONNECT {"pedantic": false, "verbose": false, "ssl_required": false, "name": "foo"}\r\n',
response='INFO {"foo": "bar"}\r\n'
)
3
Example 2
def test_gethostname(self):
hostname = socket.gethostname()
Mocket.enable()
self.assertEqual(socket.gethostname(), 'localhost')
Mocket.disable()
self.assertEqual(socket.gethostname(), hostname)
3
Example 3
def test_gethostbyname(self):
host = socket.gethostbyname('localhost')
Mocket.enable()
self.assertEqual(socket.gethostbyname('localhost'), '127.0.0.1')
Mocket.disable()
self.assertEqual(socket.gethostbyname('localhost'), host)