summaryrefslogtreecommitdiffstats
path: root/test/t/test_xfreerdp.py
blob: 56162714c0c9f35a7c875c628340a8ca000c8b96 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
import pytest

from conftest import assert_bash_exec


class TestXfreerdp:
    def _help(self, bash):
        return assert_bash_exec(
            bash, "xfreerdp --help 2>&1 || :", want_output=True
        )

    @pytest.fixture(scope="class")
    def help_success(self, bash):
        output = self._help(bash)
        # Example from our CentOS 7 container
        # [04:51:31:663] [238:238] [ERROR][com.freerdp.client.x11] - Failed to get pixmap info
        if not output or "ERROR" in output.strip().splitlines()[0]:
            pytest.skip("--help errored")

    @pytest.fixture(scope="class")
    def slash_syntax(self, bash, help_success):
        if "/help" not in self._help(bash):
            pytest.skip("Not slash syntax")

    @pytest.fixture(scope="class")
    def dash_syntax(self, bash):
        if "/help" in self._help(bash):
            pytest.skip("Not dash syntax")

    @pytest.mark.complete("xfreerdp /", require_cmd=True)
    def test_1(self, bash, completion, help_success, slash_syntax):
        assert completion

    @pytest.mark.complete("xfreerdp -", require_cmd=True)
    def test_2(self, completion, help_success):
        assert completion

    @pytest.mark.complete("xfreerdp +", require_cmd=True)
    def test_3(self, bash, completion, help_success, slash_syntax):
        assert completion

    @pytest.mark.complete(
        "xfreerdp /kbd:",
        require_cmd=True,
        skipif='test -z "$(xfreerdp /kbd-list 2>/dev/null)"',
    )
    def test_4(self, bash, completion, help_success, slash_syntax):
        assert completion

    @pytest.mark.complete("xfreerdp /help ", require_cmd=True)
    def test_5(self, completion, help_success):
        assert not completion

    @pytest.mark.complete("xfreerdp -k ", require_cmd=True)
    def test_6(self, bash, completion, help_success, dash_syntax):
        assert completion

    @pytest.mark.complete("xfreerdp --help ", require_cmd=True)
    def test_7(self, completion):
        assert not completion