code: def test_publish_heroku(
      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"heroku-builds",
          "['heroku', 'apps:list', '--json']": b"[]",
          "['heroku', 'apps:create', 'datasette', '--json']": b'{"name": "f"}',
      }[repr(s)]
      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", "heroku", "test.db", "--tar", "gtar"]
      )
      assert 0 == result.exit_code, result.output
      mock_call.assert_has_calls(
          [
              mock.call(
                  [
                      "heroku",
                      "builds:create",
                      "-a",
                      "f",
                      "--include-vcs-ignore",
                      "--tar",
                      "gtar",
                  ]
              ),
          ]
      )
  
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 4 for calling a global function with example usage: test_publish_heroku(mock_call, mock_check_output, mock_which, tmp_path_factory) without return types