code: def test_publish_heroku_installs_plugin(
      mock_call, mock_check_output, mock_which, tmp_path_factory
  ):
      mock_which.return_value = True
      mock_check_output.side_effect = lambda s: {
          "['heroku', 'plugins']": b""
      }[repr(s)]
      runner = CliRunner()
      os.chdir(tmp_path_factory.mktemp("runner"))
      with open("t.db", "w") as fp:
          fp.write("data")
      result = runner.invoke(
          cli.cli, ["publish", "heroku", "t.db"], input="y\n"
      )
      assert 0 != result.exit_code
      mock_check_output.assert_has_calls(
          [
              mock.call(["heroku", "plugins"]),
              mock.call(["heroku", "apps:list", "--json"]),
          ]
      )
      mock_call.assert_has_calls(
          [mock.call(["heroku", "plugins:install", "heroku-builds"])]
      )
  
file_path: datasette/tests/test_publish_heroku.py
imports: from click.testing import CliRunner
  from datasette import cli
  from unittest import mock
  import os
  import pathlib
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: test_publish_heroku_installs_plugin(mock_call, mock_check_output, mock_which, tmp_path_factory) without return types