code: def mock_stdin(input_from_stdin: List[Text]):
      text = ""
      for line in input_from_stdin:
          text += line + ENTER + "\r"
  
      inp = create_pipe_input()
      inp.send_text(text)
  
      prompt_session_init = PromptSession.__init__
  
      def prompt_session_init_fake(self, *k, **kw):
          prompt_session_init(
              self, input=inp, output=DummyOutput(), *k, **kw
          )
  
      PromptSession.__init__ = prompt_session_init_fake
  
      application_init = Application.__init__
  
      def application_init_fake(self, *k, **kw):
          kw.pop("input", None)
          kw.pop("output", None)
          application_init(
              self, input=inp, output=DummyOutput(), *k, **kw
          )
  
      Application.__init__ = application_init_fake
  
      return inp
  
file_path: rasa/tests/core/channels/test_cmdline.py
imports: from typing import List, Text
  from _pytest.capture import CaptureFixture
  from _pytest.monkeypatch import MonkeyPatch
  from prompt_toolkit import PromptSession, Application
  from prompt_toolkit.input.defaults import create_pipe_input
  from prompt_toolkit.output import DummyOutput
  from rasa.core.channels.console import record_messages
  from aioresponses import aioresponses
label_desc: Use image node_id 1 for calling a global function with example usage: mock_stdin(input_from_stdin) and returns: inp