code: def test_magic_parameters_csrf_json(
      magic_parameters_client, use_csrf, return_json
  ):
      magic_parameters_client.ds.config["databases"]["data"]["queries"][
          "runme_post"
      ]["sql"] = "insert into logs (line) values (:_header_host)"
      qs = ""
      if return_json:
          qs = "?_json=1"
      response = magic_parameters_client.post(
          f"/data/runme_post{qs}",
          {},
          csrftoken_from=use_csrf or None,
      )
      if return_json:
          assert response.status == 200
          assert response.json["ok"], response.json
      else:
          assert response.status == 302
          messages = magic_parameters_client.ds.unsign(
              response.cookies["ds_messages"], "messages"
          )
          assert [["Query executed, 1 row affected", 1]] == messages
      post_actual = magic_parameters_client.get(
          "/data/logs.json?_sort_desc=rowid&_shape=array"
      ).json[0]["line"]
      assert post_actual == "localhost"
  
imports: from bs4 import BeautifulSoup
  import json
  import pytest
  import re
  from .fixtures import make_app_client, app_client
label_desc: Use image node_id 19 for calling a global function with example usage: test_magic_parameters_csrf_json(magic_parameters_client, use_csrf, return_json) without return types