Debian Codegraph @

test/unit/console_tool/test_help.py

raw
1 ######################################################################
2 #
3 # File: test/unit/console_tool/test_help.py
4 #
5 # Copyright 2023 Backblaze Inc. All Rights Reserved.
6 #
7 # License https://www.backblaze.com/using_b2_code.html
8 #
9 ######################################################################
10 import pytest
11
12
13 @pytest.mark.parametrize(
14 "flag, included, excluded",
15 [
16 # --help shouldn't show deprecated commands
17 (
18 "--help",
19 [" b2 download-file ", "-h", "--help-all"],
20 [" download-file-by-name ", "(DEPRECATED)"],
21 ),
22 # --help-all should show deprecated commands, but marked as deprecated
23 (
24 "--help-all",
25 ["(DEPRECATED) b2 download-file-by-name ", "-h", "--help-all"],
26 [],
27 ),
28 ],
29 )
30 def test_help(b2_cli, flag, included, excluded, capsys):
31 b2_cli.run([flag], expected_stdout=None)
32
33 out = capsys.readouterr().out
34
35 found = set()
36 for i in included:
37 if i in out:
38 found.add(i)
39 for e in excluded:
40 if e in out:
41 found.add(e)
42 assert found.issuperset(included), f"expected {included!r} in {out!r}"
43 assert found.isdisjoint(excluded), f"expected {excluded!r} not in {out!r}"