code: def test_view_padlock(
      allow, expected_anon, expected_auth, path, padlock_client
  ):
      padlock_client.ds.config["allow"] = allow
      fragment = "🔒</h1>"
      anon_response = padlock_client.get(path)
      assert expected_anon == anon_response.status
      if allow and anon_response.status == 200:
          # Should be no padlock
          assert fragment not in anon_response.text
      auth_response = padlock_client.get(
          path,
          cookies={
              "ds_actor": padlock_client.actor_cookie({"id": "root"})
          },
      )
      assert expected_auth == auth_response.status
      # Check for the padlock
      if allow and expected_anon == 403 and expected_auth == 200:
          assert fragment in auth_response.text
      del padlock_client.ds.config["allow"]
  
imports: import collections
  from datasette.app import Datasette
  from datasette.cli import cli
  from datasette.default_permissions import restrictions_allow_action
  from .fixtures import app_client, assert_permissions_checked, make_app_client
  from click.testing import CliRunner
  from bs4 import BeautifulSoup
  import copy
  import json
  from pprint import pprint
  import pytest_asyncio
  import pytest
  import re
  import time
  import urllib
label_desc: Use image node_id 2 for calling a global function with example usage: test_view_padlock(allow, expected_anon, expected_auth, path, padlock_client) without return types