@mock.patch('fbpush.push.logger.info')
    @mock.patch('fbpush.push.logger.debug')
    @mock.patch('fbpush.main.logger.info')
    @mock.patch('fbpush.main.reactor.callLater')
    @mock.patch.object(push.JunoscriptRpc, 'getNextConfiglet')
    def test_success_config_upload(self, mock_getNextConfiglet, mock_reactor,
                                   mock_main_log, mock_debug, mock_info):
        mock_getNextConfiglet.return_value = self.configlet
        self.mock_JunoscriptRpc.updateStatus = mock.MagicMock()
        self.mock_JunoscriptRpc.uploadConfiguration()
        msg = 'Uploading configlet %s on device %s'
        kwargs = {}
        kwargs['format'] = 'text'
        kwargs['action'] = 'replace'
        kwargs['configuration_text'] = self.configlet.escaped_text
        umsg = u'UPLOADING CONFIGLET %s' % self.configlet.name

        # Now call send_xml_call method which contains checks for the
        # sending xml requests to the network devices.
        self.send_xml_call(mock_info, 'u', umsg, True,
                           'load_configuration', msg, self.configlet.name,
                           self.device.name, **kwargs)

        lock_response = self.read_xml_file('uploaded_configuration.xml')
        self.mock_JunoscriptRpc.updateStatus = mock.MagicMock()

        # Setting the state to the one where the fsm would have been
        # in the normal workflow of the code. In this case the method
        # testConfigUpload would be called only after 'configUpload'
        # method which sets the state to ST_CONFIG_LOCK_TESTING.
        # This prev_state is common for both success and failure.
        jnx = self.mock_JunoscriptRpc

        jnx.fsm.state = jnx.fsm.ST_CONFIG_LOCK_TESTING
        prev_state = jnx.fsm.state

        # Testing the code when the xml_reply is successful
        EV_TEST_SUCCESS = self.mock_JunoscriptRpc.fsm.EV_TEST_SUCCESS

        self.mock_JunoscriptRpc.testConfigUpload(lock_response)
        self.success_reply_xml(None, 'CONFIGLET UPLOADED', True,
                               jnx, EV_TEST_SUCCESS,
                               prev_state)
Starts Neovim
dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushJunoscriptRpcTestCase.test_success_config_upload--crossover with--dataset/ETHPy150Open google/vroom/vroom/neovim_mod.py/Communicator.Start