diff options
Diffstat (limited to 'test/t/test_sudo.py')
-rw-r--r-- | test/t/test_sudo.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/test/t/test_sudo.py b/test/t/test_sudo.py index ced6662e..a3494664 100644 --- a/test/t/test_sudo.py +++ b/test/t/test_sudo.py @@ -10,27 +10,27 @@ class TestSudo: @pytest.mark.complete("sudo cd fo", cwd="shared/default") def test_2(self, completion): - assert completion == "foo.d/" + assert completion == "o.d/" assert not completion.endswith(" ") @pytest.mark.complete("sudo sh share") def test_3(self, completion): - assert completion == "shared/" + assert completion == "d/" assert not completion.endswith(" ") @pytest.mark.complete("sudo mount /dev/sda1 def", cwd="shared") def test_4(self, completion): - assert completion == "default/" + assert completion == "ault/" assert not completion.endswith(" ") @pytest.mark.complete("sudo -e -u root bar foo", cwd="shared/default") def test_5(self, completion): - assert completion == ["foo", "foo.d/"] + assert completion == "foo foo.d/".split() def test_6(self, bash, part_full_user): part, full = part_full_user completion = assert_complete(bash, "sudo chown %s" % part) - assert completion == full + assert completion == full[len(part) :] assert completion.endswith(" ") def test_7(self, bash, part_full_user, part_full_group): @@ -39,32 +39,32 @@ class TestSudo: completion = assert_complete( bash, "sudo chown %s:%s" % (user, partgroup) ) - assert completion == "%s:%s" % (user, fullgroup) + assert completion == fullgroup[len(partgroup) :] assert completion.endswith(" ") def test_8(self, bash, part_full_group): part, full = part_full_group completion = assert_complete(bash, "sudo chown dot.user:%s" % part) - assert completion == "dot.user:%s" % full + assert completion == full[len(part) :] assert completion.endswith(" ") - @pytest.mark.xfail # TODO check escaping, whitespace - def test_9(self, bash, part_full_group): - """Test preserving special chars in $prefix$partgroup<TAB>.""" - part, full = part_full_group - for prefix in ( + @pytest.mark.parametrize( + "prefix", + [ r"funky\ user:", "funky.user:", r"funky\.user:", r"fu\ nky.user:", r"f\ o\ o\.\bar:", r"foo\_b\ a\.r\ :", - ): - completion = assert_complete( - bash, "sudo chown %s%s" % (prefix, part) - ) - assert completion == "%s%s" % (prefix, full) - assert completion.endswith(" ") + ], + ) + def test_9(self, bash, part_full_group, prefix): + """Test preserving special chars in $prefix$partgroup<TAB>.""" + part, full = part_full_group + completion = assert_complete(bash, "sudo chown %s%s" % (prefix, part)) + assert completion == full[len(part) :] + assert completion.endswith(" ") def test_10(self, bash, part_full_user, part_full_group): """Test giving up on degenerate cases instead of spewing junk.""" |