File: ro_cli_test.py

package info (click to toggle)
python-bugzilla 3.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,116 kB
  • sloc: python: 6,160; makefile: 7
file content (47 lines) | stat: -rw-r--r-- 1,721 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Ignoring pytest-related warnings:
# pylint: disable=unused-argument
from ..utils import open_bz
from . import TEST_URL, TEST_PRODUCTS, TEST_SUSE_COMPONENTS, TEST_OWNER


def test_get_products(mocked_responses, run_cli, backends):
    bz = open_bz(url=TEST_URL, **backends)
    out = run_cli("bugzilla info --products", bzinstance=bz)
    assert len(out.strip().split("\n")) == 3

    for product in TEST_PRODUCTS:
        assert product in out


def test_get_components(mocked_responses, run_cli, backends):
    bz = open_bz(url=TEST_URL, **backends)
    out = run_cli("bugzilla info --components 'SUSE Linux Enterprise Server 15 SP6'", bzinstance=bz)
    assert len(out.strip().split("\n")) == 2
    for comp in TEST_SUSE_COMPONENTS:
        assert comp in out


def test_get_component_owners(mocked_responses, run_cli, backends):
    bz = open_bz(url=TEST_URL, **backends)
    out = run_cli("bugzilla info --component_owners 'SUSE Linux Enterprise Server 15 SP6'",
                  bzinstance=bz)
    assert TEST_OWNER in out


def test_get_versions(mocked_responses, run_cli, backends):
    bz = open_bz(url=TEST_URL, **backends)
    out = run_cli("bugzilla info --versions 'Red Hat Enterprise Linux 9'", bzinstance=bz)
    versions = set(out.strip().split("\n"))

    assert versions == {"unspecified", "9.0", "9.1"}


def test_query(mocked_responses, run_cli, backends):
    bz = open_bz(url=TEST_URL, **backends)
    out = run_cli("bugzilla query --product 'Red Hat Enterprise Linux 9' "
                  "--component 'python-bugzilla'", bzinstance=bz)
    lines = out.strip().splitlines()

    assert len(lines) == 1
    assert lines[0].startswith("#2")
    assert "Expect the Spanish inquisition" in lines[0]