def test_clone_should_invoke_vcs_command(
    mocker, clone_dir, repo_type, repo_url, repo_name
) -> None:
    """When `clone()` is called with a git/hg repo, the corresponding VCS \
    command should be run via `subprocess.check_output()`.

    This should take place:
    * In the correct dir
    * With the correct args.
    """
    mocker.patch('cookiecutter.vcs.is_vcs_installed', autospec=True, return_value=True)

    mock_subprocess = mocker.patch(
        'cookiecutter.vcs.subprocess.check_output',
        autospec=True,
    )
    expected_repo_dir = os.path.normpath(os.path.join(clone_dir, repo_name))

    branch = 'foobar'

    repo_dir = vcs.clone(
        repo_url, checkout=branch, clone_to_dir=clone_dir, no_input=True
    )

    assert repo_dir == expected_repo_dir

    mock_subprocess.assert_any_call(
        [repo_type, 'clone', repo_url], cwd=clone_dir, stderr=subprocess.STDOUT
    )

    branch_info = [branch]
    # We sanitize branch information for Mercurial
    if repo_type == "hg":
        branch_info.insert(0, "--")

    mock_subprocess.assert_any_call(
        [repo_type, 'checkout', *branch_info],
        cwd=expected_repo_dir,
        stderr=subprocess.STDOUT,
    )
When `clone()` is called with a git/hg repo, the corresponding VCS     command should be run via `subprocess.check_output()`.

    This should take place:
    * In the correct dir
    * With the correct args.
    
tests/vcs/test_clone.py