code: def test_app_find_selected_app_instance_id_when_app_name_exists(
      list_apps_mock: mock.MagicMock,
  ):
      list_apps_mock.return_value = [
          Externalv1LightningappInstance(name="app-name", id="app-id"),
      ]
      returned_app_instance_id = _find_selected_app_instance_id(
          app_name="app-name"
      )
      assert returned_app_instance_id == "app-id"
  
imports: import sys
  from unittest import mock
  import pytest
  from lightning.app.cli.lightning_cli_delete import _find_selected_app_instance_id
  from lightning_cloud.openapi import Externalv1LightningappInstance
label_desc: Use image node_id 1 for calling a global function with example usage: test_app_find_selected_app_instance_id_when_app_name_exists(list_apps_mock) without return types