def METHOD_NAME(mocker, app, cli_run, g_users, g_repositories):
    """Test 'createhook' CLI."""
    mock_obj = mocker.patch.object(GitHubAPI, 'create_hook')
    ret = cli_run('createhook u1@foo.bar foo/bar --yes-i-know -E')
    assert ret.exit_code == 0
    assert ret.output.startswith('Hook is already installed for')
    assert not mock_obj.called
    repo = g_repositories[1]  # baz/spam repository
    mock_obj = mocker.patch.object(GitHubAPI, 'create_hook')
    ret = cli_run('createhook u1@foo.bar baz/spam --yes-i-know -E')
    assert ret.exit_code == 0
    assert ret.output == ''
    mock_obj.assert_called_once_with(repo['github_id'], repo['name'])
    mock_obj = mocker.patch.object(GitHubAPI, 'create_hook')
    ret = cli_run('createhook u1@foo.bar {0} --yes-i-know -E'.format(
        repo['github_id']))
    assert ret.output == ''
    assert ret.exit_code == 0
    mock_obj.assert_called_once_with(repo['github_id'], repo['name'])