diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.net.br> | 2020-08-03 18:43:13 -0300 |
commit | 95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch) | |
tree | ea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/test_nmap.py | |
parent | 019f3cc463db63abc6460f97deb488deec43840b (diff) | |
download | bash-completion-upstream.tar.gz |
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'test/t/test_nmap.py')
-rw-r--r-- | test/t/test_nmap.py | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/test/t/test_nmap.py b/test/t/test_nmap.py index a4d8a899..9aff8b29 100644 --- a/test/t/test_nmap.py +++ b/test/t/test_nmap.py @@ -1,7 +1,47 @@ import pytest +from conftest import assert_bash_exec + class TestNmap: - @pytest.mark.complete("nmap --v") - def test_1(self, completion): + @pytest.fixture(scope="class") + def functions(self, request, bash): + assert_bash_exec(bash, "_mock_nmap() { cat nmap/nmap-h.txt; }") + assert_bash_exec(bash, "complete -F _nmap _mock_nmap") + + @pytest.mark.complete("nmap --v", require_cmd=True) + def test_live_options(self, completion): + assert completion + + @pytest.mark.complete("nmap ") + def test_hosts(self, completion): assert completion + + @pytest.mark.complete("_mock_nmap -") + def test_mock_options(self, completion, functions): + assert completion == sorted( + "-iL -iR --exclude --excludefile -sL -sn -Pn -PS -PA -PU -PY -PE " + "-PP -PM -PO -n -R --dns-servers --system-dns --traceroute -sS " + "-sT -sA -sW -sM -sU -sN -sF -sX --scanflags -sI -sY -sZ -sO -b " + "-p --exclude-ports -F -r --top-ports --port-ratio -sV " + "--version-intensity --version-light --version-all " + "--version-trace -sC --script= --script-args= --script-args-file= " + "--script-trace --script-updatedb --script-help= -O " + "--osscan-limit --osscan-guess " + # TODO: -T known mishandled; should expand -T<0-5> to -T0 ... -T5 + "-T --min-hostgroup --max-hostgroup --min-parallelism " + "--max-parallelism --min-rtt-timeout --max-rtt-timeout " + "--initial-rtt-timeout --max-retries --host-timeout --scan-delay " + "--max-scan-delay --min-rate --max-rate -f --mtu -D -S -e -g " + "--source-port --proxies --data --data-string --data-length " + "--ip-options --ttl --spoof-mac --badsum -oN -oX -oS -oG -oA -v " + "-d --reason --open --packet-trace --iflist --append-output " + "--resume --stylesheet --webxml --no-stylesheet -6 -A --datadir " + "--send-eth --send-ip --privileged --unprivileged -V -h" + "".strip().split() + ) + + @pytest.mark.complete("_mock_nmap --script-args-f") + def test_mock_nospace(self, completion, functions): + assert completion == "ile=" + assert completion.endswith("=") # no space appended |