How to use the mocket.mocket.Mocket.disable function in mocket

To help you get started, we’ve selected a few mocket examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mindflayer / python-mocket / tests / test_mocket.py View on Github external
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)
github mindflayer / python-mocket / tests / test_mocket.py View on Github external
def test_gethostname(self):
        hostname = socket.gethostname()
        Mocket.enable()
        self.assertEqual(socket.gethostname(), 'localhost')
        Mocket.disable()
        self.assertEqual(socket.gethostname(), hostname)
github mindflayer / python-mocket / mocket / mocket.py View on Github external
def __exit__(self, type, value, tb):
        if self.instance:
            self.check_and_call("mocketize_teardown")
        Mocket.disable()