summaryrefslogtreecommitdiffstats
path: root/test/t/test_info.py
blob: 2fdbccae9912d640e31715f90f2b9b9cd322305e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest


@pytest.mark.bashcomp(pre_cmds=("INFOPATH+=:$PWD/info:",))
class TestInfo:
    @pytest.mark.complete("info bash")
    def test_1(self, completion):
        assert completion

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

    @pytest.mark.complete(
        "info nonexistent-na",
        env=dict(INFOPATH="'$(echo malicious code >/dev/tty)'"),
    )
    def test_infopath_code_injection(self, completion):
        # no completion, no space appended
        assert not completion