code: def test_publish_cloudrun(
      mock_call, mock_output, mock_which, tmp_path_factory
  ):
      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", "--service", "test"],
      )
      assert 0 == result.exit_code
      tag = f"gcr.io/{mock_output.return_value}/datasette-test"
      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 {} test".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 4 for calling a global function with example usage: test_publish_cloudrun(mock_call, mock_output, mock_which, tmp_path_factory) without return types