code: def test_lightning_run_app_cloud_with_run_app_commands(
      mock_dispatch: mock.MagicMock, open_ui, caplog, monkeypatch
  ):
      """This test validates the command has ran properly when --cloud argument is passed.
  
      It tests it by checking if the click.launch is called with the right url if --open-ui was true and also checks the
      call to `dispatch` for the right arguments.
  
      """
      monkeypatch.setattr(
          "lightning.app.runners.cloud.logger", logging.getLogger()
      )
  
      with caplog.at_level(logging.INFO):
          _run_app(
              file=os.path.join(
                  _PROJECT_ROOT,
                  "tests/tests_app/core/scripts/app_metadata.py",
              ),
              cloud=True,
              without_server=False,
              name="",
              blocking=False,
              open_ui=open_ui,
              no_cache=True,
              env=("FOO=bar",),
              secret=("BAR=my-secret",),
              run_app_comment_commands=True,
              enable_basic_auth="",
          )
  
          # Get the designated port
          port = constants.APP_SERVER_PORT
  
      # capture logs.
      # TODO(yurij): refactor the test, check if the actual HTTP request is being sent and that the proper admin
      #  page is being opened
      mock_dispatch.assert_called_with(
          Path(
              os.path.join(
                  _PROJECT_ROOT,
                  "tests/tests_app/core/scripts/app_metadata.py",
              )
          ),
          RuntimeType.CLOUD,
          start_server=True,
          blocking=False,
          open_ui=open_ui,
          name="",
          no_cache=True,
          env_vars={"FOO": "bar"},
          secrets={"BAR": "my-secret"},
          run_app_comment_commands=True,
          enable_basic_auth="",
          port=port,
      )
  
file_path: pytorch-lightning/tests/tests_app/cli/test_run_app.py
imports: import logging
  import os
  from pathlib import Path
  from unittest import mock
  import click
  import lightning.app.core.constants
  import pytest
  from click.testing import CliRunner
  from lightning.app import LightningApp
  from lightning.app.cli.lightning_cli import _run_app, run_app
  from lightning.app.runners.runtime_type import RuntimeType
  from lightning.app.utilities.app_helpers import convert_print_to_logger_info
  from tests_app import _PROJECT_ROOT
label_desc: Use image node_id 3 for calling a global function with example usage: test_lightning_run_app_cloud_with_run_app_commands(mock_dispatch, open_ui, caplog, monkeypatch) without return types