code: def test_hook_forbidden(restore_working_directory):
      with make_app_client(
          extra_databases={"data2.db": "create table logs (line text)"},
          config={"allow": {}},
      ) as client:
          response = client.get("/")
          assert response.status_code == 403
          response2 = client.get("/data2")
          assert 302 == response2.status
          assert (
              response2.headers["Location"]
              == "/login?message=You do not have permission to view this database"
          )
          assert (
              client.ds._last_forbidden_message
              == "You do not have permission to view this database"
          )
  
imports: from bs4 import BeautifulSoup
  from .fixtures import app_client, app_client, make_app_client, TABLES, TEMP_PLUGIN_SECRET_FILE, PLUGINS_DIR, TestClient
  from click.testing import CliRunner
  from datasette.app import Datasette
  from datasette import cli, hookimpl, Permission
  from datasette.filters import FilterArguments
  from datasette.plugins import get_plugins, DEFAULT_PLUGINS, pm
  from datasette.utils.sqlite import sqlite3
  from datasette.utils import CustomRow, StartupError
  from jinja2.environment import Template
  from jinja2 import ChoiceLoader, FileSystemLoader
  import base64
  import importlib
  import json
  import os
  import pathlib
  import re
  import textwrap
  import pytest
  import urllib
label_desc: Use image node_id 15 for calling a global function with example usage: test_hook_forbidden(restore_working_directory) without return types