| 1 |
###################################################################### |
| 2 |
# |
| 3 |
# File: test/integration/test_help.py |
| 4 |
# |
| 5 |
# Copyright 2024 Backblaze Inc. All Rights Reserved. |
| 6 |
# |
| 7 |
# License https://www.backblaze.com/using_b2_code.html |
| 8 |
# |
| 9 |
###################################################################### |
| 10 |
import platform |
| 11 |
import re |
| 12 |
import subprocess |
| 13 |
|
| 14 |
|
| 15 |
def test_help(cli_version): |
| 16 |
p = subprocess.run( |
| 17 |
[cli_version, "--help"], |
| 18 |
check=True, |
| 19 |
capture_output=True, |
| 20 |
text=True, |
| 21 |
) |
| 22 |
|
| 23 |
# verify help contains apiver binary name |
| 24 |
expected_name = cli_version |
| 25 |
if platform.system() == 'Windows': |
| 26 |
expected_name += '.exe' |
| 27 |
assert re.match(r"^_?b2(v\d+)?(\.exe)?$", expected_name) # test sanity check |
| 28 |
assert f" {expected_name} <command> --help" in p.stdout |