code: def test_logout(app_client):
      # Keeping app_client for the moment because of csrftoken_from
      response = app_client.get(
          "/-/logout",
          cookies={"ds_actor": app_client.actor_cookie({"id": "test"})},
      )
      assert 200 == response.status
      assert (
          "<p>You are logged in as <strong>test</strong></p>"
          in response.text
      )
      # Actors without an id get full serialization
      response2 = app_client.get(
          "/-/logout",
          cookies={
              "ds_actor": app_client.actor_cookie({"name2": "bob"})
          },
      )
      assert 200 == response2.status
      assert (
          "<p>You are logged in as <strong>{&#39;name2&#39;: &#39;bob&#39;}</strong></p>"
          in response2.text
      )
      # If logged out you get a redirect to /
      response3 = app_client.get("/-/logout")
      assert 302 == response3.status
      # A POST to that page should log the user out
      response4 = app_client.post(
          "/-/logout",
          csrftoken_from=True,
          cookies={"ds_actor": app_client.actor_cookie({"id": "test"})},
      )
      # The ds_actor cookie should have been unset
      assert cookie_was_deleted(response4, "ds_actor")
      # Should also have set a message
      messages = app_client.ds.unsign(
          response4.cookies["ds_messages"], "messages"
      )
      assert [["You are now logged out", 2]] == messages
  
file_path: datasette/tests/test_auth.py
imports: from bs4 import BeautifulSoup
  from .fixtures import app_client
  from .utils import cookie_was_deleted
  from click.testing import CliRunner
  from datasette.utils import baseconv
  from datasette.cli import cli
  import pytest
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: test_logout(app_client) without return types