client/tests/interconnect/bluetooth_test.py
def _setup_mocks_and_patches(self):
        """
        Set up all the patches and mocks needed for the tests in this suite.
        """

        # Set up patches for socket.Socket() create_default_context()
        # along with and add cleanup.
        self._mock_socket_constructor = patch('socket.socket').start()
        self._mock_create_default_context = (
            patch('ssl.create_default_context').start()
        )
        self.addCleanup(patch.stopall)

        # Create a mock socket instance and make sure it is returned by the
        # mock socket constructor.
        self._mock_socket_instance = MagicMock()
        self._mock_socket_constructor.return_value = \
            self._mock_socket_instance

        # Create a mock SSLContext instance and make sure it is returned by
        # the mock create_default_context method.
        self._mock_ssl_context = MagicMock()
        self._mock_create_default_context.return_value = \
            self._mock_ssl_context

        # Create a mock ssl socket and return it from SSLContext.wrap_socket().
        self._mock_ssl_socket = MagicMock()
        self._mock_ssl_context.wrap_socket.return_value = \
            self._mock_ssl_socket

        Set up all the patches and mocks needed for the tests in this suite.
        
Set up all the patches and mocks needed for the tests in this suite.
Set up all the patches and mocks needed for the tests in this suite .
def _setup_mocks_and_patches(self):
        self._mock_socket_constructor = patch('socket.socket').start()
        self._mock_create_default_context = (
            patch('ssl.create_default_context').start()
        )
        self.addCleanup(patch.stopall)
        self._mock_socket_instance = MagicMock()
        self._mock_socket_constructor.return_value = \
            self._mock_socket_instance
        self._mock_ssl_context = MagicMock()
        self._mock_create_default_context.return_value = \
            self._mock_ssl_context
        self._mock_ssl_socket = MagicMock()
        self._mock_ssl_context.wrap_socket.return_value = \
            self._mock_ssl_socket
def _setup_mocks_and_patches ( self ) : self . _mock_socket_constructor = patch ( 'socket.socket' ) . start ( ) self . _mock_create_default_context = ( patch ( 'ssl.create_default_context' ) . start ( ) ) self . addCleanup ( patch . stopall ) self . _mock_socket_instance = MagicMock ( ) self . _mock_socket_constructor . return_value = self . _mock_socket_instance self . _mock_ssl_context = MagicMock ( ) self . _mock_create_default_context . return_value = self . _mock_ssl_context self . _mock_ssl_socket = MagicMock ( ) self . _mock_ssl_context . wrap_socket . return_value = self . _mock_ssl_socket
Set up all the patches and mocks needed for the tests in this suite.
Set up all the patches and mocks needed for the tests in this suite .
"""
        Set up all the patches and mocks needed for the tests in this suite.
        """ # Set up patches for socket.Socket() create_default_context() # along with and add cleanup. # Create a mock socket instance and make sure it is returned by the # mock socket constructor. # Create a mock SSLContext instance and make sure it is returned by # the mock create_default_context method. # Create a mock ssl socket and return it from SSLContext.wrap_socket().
self