scripts: Add a script to generate "cros query" docs

Using the command line for "cros query" involves knowing the
attributes which can be queried.  Create a script which generates
Markdown documentation for each query target, and add tests that the
generated Markdown file matches.

This isn't meant to be complete documentation to "cros query", but
only the auto-generated side of things.  I plan to add a
docs/cros-query.md later with the higher-level discussion of the tool,
and link out to these docs as required.

BUG=b:277149457
TEST=unit tests
TEST=view markdown in gitiles

Change-Id: I4247063c95593d97f47d628ff319ed2f0965903b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4435355
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Auto-Submit: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/generate_query_docs_unittest.py b/scripts/generate_query_docs_unittest.py
new file mode 100644
index 0000000..3c68353
--- /dev/null
+++ b/scripts/generate_query_docs_unittest.py
@@ -0,0 +1,23 @@
+# Copyright 2023 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Tests for generate_query_docs.py."""
+
+from chromite.scripts import generate_query_docs
+
+
+def test_generated_contents(tmp_path):
+    """Test the output file matches the generated contents."""
+    # pylint: disable=protected-access
+    current_file = generate_query_docs._DEFAULT_OUTPUT
+    current_contents = current_file.read_text(encoding="utf-8")
+
+    new_file = tmp_path / "output.md"
+    generate_query_docs.main(["-o", str(new_file)])
+    new_contents = new_file.read_text(encoding="utf-8")
+
+    assert current_contents == new_contents, (
+        f"{current_file} needs regenerated.  Please run "
+        "scripts/generate_query_docs.",
+    )