summaryrefslogtreecommitdiff
path: root/tests/test_completion.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r--tests/test_completion.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py
index a5cec508..f7caf03a 100644
--- a/tests/test_completion.py
+++ b/tests/test_completion.py
@@ -341,25 +341,19 @@ def test_path_completion_doesnt_match_wildcards(cmd2_app, request):
# Currently path completion doesn't accept wildcards, so will always return empty results
assert cmd2_app.path_complete(text, line, begidx, endidx) == []
-def test_path_completion_invalid_syntax(cmd2_app):
- # Test a missing separator between a ~ and path
- text = '~Desktop'
- line = 'shell fake {}'.format(text)
- endidx = len(line)
- begidx = endidx - len(text)
-
- assert cmd2_app.path_complete(text, line, begidx, endidx) == []
+def test_path_completion_expand_user_dir(cmd2_app):
+ # Get the current user. We can't use getpass.getuser() since
+ # that doesn't work when running these tests on Windows in AppVeyor.
+ user = os.path.basename(os.path.expanduser('~'))
-def test_path_completion_just_tilde(cmd2_app):
- # Run path with just a tilde
- text = '~'
+ text = '~{}'.format(user)
line = 'shell fake {}'.format(text)
endidx = len(line)
begidx = endidx - len(text)
- completions_tilde = cmd2_app.path_complete(text, line, begidx, endidx)
+ completions = cmd2_app.path_complete(text, line, begidx, endidx)
- # Path complete should complete the tilde with a slash
- assert completions_tilde == [text + os.path.sep]
+ expected = text + os.path.sep
+ assert expected in completions
def test_path_completion_user_expansion(cmd2_app):
# Run path with a tilde and a slash