mocket.mocket.Mocket.enable

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 7

Example 1

Project: pynats Source File: test_connection.py
Function: set_up
    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'
        )

Example 2

Project: python-mocket Source File: test_mocket.py
Function: test_get_host_name
    def test_gethostname(self):
        hostname = socket.gethostname()
        Mocket.enable()
        self.assertEqual(socket.gethostname(), 'localhost')
        Mocket.disable()
        self.assertEqual(socket.gethostname(), hostname)

Example 3

Project: python-mocket Source File: test_mocket.py
Function: test_gethostbyname
    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)