blob: 3c68353c3876a189d367c0c2256cb66c0c6e8112 [file] [log] [blame]
Jack Rosenthal46e24bc2023-04-17 12:25:41 -06001# Copyright 2023 The ChromiumOS Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Tests for generate_query_docs.py."""
6
7from chromite.scripts import generate_query_docs
8
9
10def test_generated_contents(tmp_path):
11 """Test the output file matches the generated contents."""
12 # pylint: disable=protected-access
13 current_file = generate_query_docs._DEFAULT_OUTPUT
14 current_contents = current_file.read_text(encoding="utf-8")
15
16 new_file = tmp_path / "output.md"
17 generate_query_docs.main(["-o", str(new_file)])
18 new_contents = new_file.read_text(encoding="utf-8")
19
20 assert current_contents == new_contents, (
21 f"{current_file} needs regenerated. Please run "
22 "scripts/generate_query_docs.",
23 )