Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
mocket.Mocket.disable()
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)
def test_gethostname(self):
hostname = socket.gethostname()
Mocket.enable()
self.assertEqual(socket.gethostname(), 'localhost')
Mocket.disable()
self.assertEqual(socket.gethostname(), hostname)
def __exit__(self, type, value, tb):
if self.instance:
self.check_and_call("mocketize_teardown")
Mocket.disable()
def activate(self):
Mocket.disable()
Mocket.enable()
def disable(self):
Mocket.disable()