code: def test_publish_cloudrun_prompts_for_service(
      mock_get_existing_services,
      mock_call,
      mock_output,
      mock_which,
      tmp_path_factory,
  ):
      mock_get_existing_services.return_value = [
          {
              "name": "existing",
              "created": "2019-01-01",
              "url": "http://www.example.com/",
          }
      ]
      mock_output.return_value = "myproject"
      mock_which.return_value = True
      runner = CliRunner()
      os.chdir(tmp_path_factory.mktemp("runner"))
      with open("test.db", "w") as fp:
          fp.write("data")
      result = runner.invoke(
          cli.cli,
          ["publish", "cloudrun", "test.db"],
          input="input-service",
      )
      assert (
          "Please provide a service name for this deployment\n\n"
          "Using an existing service name will over-write it\n\n"
          "Your existing services:\n\n"
          "  existing - created 2019-01-01 - http://www.example.com/\n\n"
          "Service name: input-service"
      ) == result.output.strip()
      assert 0 == result.exit_code
      tag = "gcr.io/myproject/datasette-input-service"
      mock_call.assert_has_calls(
          [
              mock.call(
                  f"gcloud builds submit --tag {tag}", shell=True
              ),
              mock.call(
                  "gcloud run deploy --allow-unauthenticated --platform=managed --image {} input-service".format(
                      tag
                  ),
                  shell=True,
              ),
          ]
      )
  
file_path: datasette/tests/test_publish_cloudrun.py
imports: from click.testing import CliRunner
  from datasette import cli
  from unittest import mock
  import json
  import os
  import pytest
  import textwrap
label_desc: Use image node_id 3 for calling a global function with example usage: test_publish_cloudrun_prompts_for_service(mock_get_existing_services, mock_call, mock_output, mock_which, tmp_path_factory) without return types