summaryrefslogtreecommitdiff
path: root/test/t/test_finger.py
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.net.br>2020-08-03 18:43:13 -0300
commit95623d39d6029ba78ec96ad5ea08e9ac12629b91 (patch)
treeea0fe36eb5e6f40e0a1f765d44c4b0c0b2bfb089 /test/t/test_finger.py
parent019f3cc463db63abc6460f97deb488deec43840b (diff)
downloadbash-completion-upstream.tar.gz
New upstream version 2.11upstream/2.11upstream
Diffstat (limited to 'test/t/test_finger.py')
-rw-r--r--test/t/test_finger.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/t/test_finger.py b/test/t/test_finger.py
index 92c983fa..d765fdd7 100644
--- a/test/t/test_finger.py
+++ b/test/t/test_finger.py
@@ -1,16 +1,12 @@
import pytest
-from conftest import assert_bash_exec
+from conftest import assert_complete, partialize
class TestFinger:
@pytest.fixture(scope="class")
- def users_at(self, bash):
- return sorted(
- assert_bash_exec(
- bash, "compgen -A user -S @", want_output=True
- ).split()
- )
+ def users_at(self, bash, output_sort_uniq):
+ return output_sort_uniq("compgen -u -S @")
@pytest.mark.complete("finger ")
def test_1(self, bash, completion, users_at):
@@ -21,5 +17,17 @@ class TestFinger:
if not any(x.startswith("r") for x in users_at):
pytest.skip("No users starting with r")
assert completion
- assert all(x.startswith("r") for x in completion)
+ idx = 1 if len(completion) == 1 else 0
+ assert completion == sorted(
+ x[idx:] for x in users_at if x.startswith("r")
+ )
assert not completion.endswith(" ")
+
+ def test_partial_hostname(self, bash, known_hosts):
+ first_char, partial_hosts = partialize(bash, known_hosts)
+ user = "test"
+ completion = assert_complete(bash, "finger %s@%s" % (user, first_char))
+ if len(completion) == 1:
+ assert completion == partial_hosts[0][1:]
+ else:
+ assert completion == ["%s@%s" % (user, x) for x in partial_hosts]