@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_authentication(self, mock_reactor, mock_main_log,
                                    mock_debug, mock_info):
        self.mock_JunoscriptRpc.updateStatus = mock.MagicMock()
        self.mock_JunoscriptRpc.authenticate()
        msg = "Authenticating on device %s with username %s"
        kwargs = {}
        kwargs['username'] = config.username
        kwargs['challenge_response'] = config.password

        # Now call send_xml_call ethod which contains checks for the
        # sending xml requests to the network devices.
        self.send_xml_call(mock_info, 'a', 'AUTHENTICATING', True,
                           'request_login', msg, self.device.name,
                           config.username, **kwargs)

        auth_response = self.read_xml_file('authentication_response.xml')

        # Setting the state to the one where the fsm would have been
        # in the normal workflow of the code. In this case the method
        # testAuthenticated would be called only after 'authenticate'
        # method which sets the state to ST_AUTH_TESTING.
        EV_TEST_SUCCESS = self.mock_JunoscriptRpc.fsm.EV_TEST_SUCCESS
        jnx = self.mock_JunoscriptRpc

        jnx.fsm.state = jnx.fsm.ST_AUTH_TESTING
        prev_state = jnx.fsm.state

        # This part checks the code which is called when a success
        # message is receeived from the network devices.
        self.mock_JunoscriptRpc.testAuthenticated(auth_response)

        self.success_reply_xml(None, 'AUTHENTICATED', True,
                               jnx, EV_TEST_SUCCESS,
                               prev_state)
Grabs and returns a file from a url.
dataset/ETHPy150Open facebook/fbpush/tests/test_push.py/FBPushJunoscriptRpcTestCase.test_success_authentication--crossover with--dataset/ETHPy150Open nasa-gibs/onearth/src/test/oe_test_utils.py/get_url