def test_connect_settimeout(self): connection = Connection('host', 1) with mock.patch('socket.socket'): connection._connect() connection._sock.settimeout.assert_called_with(10)
def _get_connection(self): # TODO: Try random trackers, implement retries host, port = self._trackers[0] connection = Connection(host, port) connection._connect() return connection
def test_connect(self): connection = Connection('host', 1) with mock.patch('socket.socket'): connection._connect() connection._sock.connect.assert_called_with(('host', 1))