@mock.patch('fbpush.push.logger.info')
    @mock.patch('fbpush.push.logger.debug')
    @mock.patch('fbpush.main.logger.info')
    @mock.patch('fbpush.main.reactor.callLater')
    def test_success_commit_confirmed(self, mock_reactor, mock_main_log,
                                      mock_debug, mock_info):
        jnx = self.mock_JunoscriptRpc
        jnx.configlet_names = 'abc'
        jnx.configlet_hash = mock.MagicMock()
        jnx.configlet_hash.hexdigest = mock.MagicMock()

        jnx.configlet_hash.hexdigest.return_value = 'hex1'

        self.mock_JunoscriptRpc.updateStatus = mock.MagicMock()
        self.mock_JunoscriptRpc.commitConfirmed()
        msg = 'Executing commit confirmed on device %s'
        kwargs = {
            'log': "MD5(%s)=%s" % (','.join(jnx.configlet_names),
                                   jnx.configlet_hash.hexdigest()),
            'confirmed': True,
            'confirm_timeout': config.rollback_in
        }

        # Now call send_xml_call ethod which contains checks for the
        # sending xml requests to the network devices.
        self.send_xml_call(mock_info, '.', 'EXECUTING COMMIT CONFIRMED',
                           True,
                           'commit_configuration', msg, self.device.name,
                           **kwargs)

        cconfirmed_response = self.read_xml_file('commit_confirmed.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
        # testCommitConfirmed would be called only after 'commitConfirmed'
        # method which sets the state to ST_COMMIT_CONFIRMED_TESTING.
        # This prev_state is common for both success and failure.
        jnx = self.mock_JunoscriptRpc

        jnx.fsm.state = jnx.fsm.ST_COMMIT_CONFIRMED_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
        config.rollback_in = 140000
        self.mock_JunoscriptRpc.testCommitConfirmed(cconfirmed_response)
        self.success_reply_xml('!', 'COMMITTED CONFIRMED SUCCESSFULLY!', False,
                               jnx, EV_TEST_SUCCESS,
                               prev_state)
Ensure trace can be requested for async and non-async queries
dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushJunoscriptRpcTestCase.test_success_commit_confirmed--crossover with--dataset/ETHPy150Open datastax/python-driver/tests/integration/standard/test_cluster.py/ClusterTests.test_trace