@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_failure_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

        jnx = self.mock_JunoscriptRpc
        # 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)

        # Now testing the code when the xml reply is failure
        lock_response = self.\
            read_xml_file('uploaded_configuration_failure.xml')

        jnx.fsm.state = jnx.fsm.ST_CONFIG_LOCK_TESTING
        prev_state = jnx.fsm.state
        EV_TEST_FAILURE = self.mock_JunoscriptRpc.fsm.EV_TEST_FAILURE

        self.mock_JunoscriptRpc.testConfigUpload(lock_response)
        msg = 'upload_failure'
        log_info = 'Configlet upload on %s failed with message: %s'
        log_debug = 'RPC reply:\n%s'
        update_msg = 'Upload Failed: %s'
        umsg = update_msg % msg

        self.failure_reply_xml(jnx, EV_TEST_FAILURE, None, umsg, False,
                               prev_state,
                               log_debug, lock_response.toprettyxml(),
                               mock_info, mock_debug, log_info,
                               self.device.name, msg)
Assign datapoint `e` randomly to one of the `k` clusters.
dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushJunoscriptRpcTestCase.test_failure_config_upload--crossover with--dataset/ETHPy150Open romanorac/discomll/discomll/clustering/kmeans.py/random_init_map