File: test_help.py

package info (click to toggle)
backblaze-b2 3.19.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,372 kB
  • sloc: python: 12,571; makefile: 21; sh: 12
file content (28 lines) | stat: -rw-r--r-- 793 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
######################################################################
#
# File: test/integration/test_help.py
#
# Copyright 2024 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################
import platform
import re
import subprocess


def test_help(cli_version):
    p = subprocess.run(
        [cli_version, "--help"],
        check=True,
        capture_output=True,
        text=True,
    )

    # verify help contains apiver binary name
    expected_name = cli_version
    if platform.system() == 'Windows':
        expected_name += '.exe'
    assert re.match(r"^_?b2(v\d+)?(\.exe)?$", expected_name)  # test sanity check
    assert f" {expected_name} <command> --help" in p.stdout