diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-08-02 01:46:58 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-08-02 01:46:58 -0400 |
commit | a1ce5070ed97e90c5946b82496d33952ab3b821c (patch) | |
tree | f0916bccbcca134c1aa1b75b0db135f722d0d259 /tests | |
parent | 65875bdfc434474ecd2c019ef77fa99d3da8faf9 (diff) | |
download | cmd2-git-a1ce5070ed97e90c5946b82496d33952ab3b821c.tar.gz |
Fixed inconsistent parsing/tab completion behavior based on the value of `allow_redirection`. This flag is
only meant to be a security setting that prevents redirection of stdout and should not alter parsing logic.
Diffstat (limited to 'tests')
-rwxr-xr-x[-rw-r--r--] | tests/test_cmd2.py | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/test_completion.py | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/test_history.py | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/test_parsing.py | 1 |
4 files changed, 1 insertions, 18 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 16c5eed4..8389b9ed 100644..100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -558,7 +558,7 @@ def test_feedback_to_output_false(base_app): def test_disallow_redirection(base_app): # Set allow_redirection to False - base_app.statement_parser.allow_redirection = False + base_app.allow_redirection = False filename = 'test_allow_redirect.txt' diff --git a/tests/test_completion.py b/tests/test_completion.py index 59fe04d1..dcca1c7d 100644..100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -695,7 +695,6 @@ def test_tokens_for_completion_redirect(cmd2_app): endidx = len(line) begidx = endidx - len(text) - cmd2_app.allow_redirection = True expected_tokens = ['command', '|', '<', '>>', 'file'] expected_raw_tokens = ['command', '|', '<', '>>', 'file'] @@ -717,20 +716,6 @@ def test_tokens_for_completion_quoted_redirect(cmd2_app): assert expected_tokens == tokens assert expected_raw_tokens == raw_tokens -def test_tokens_for_completion_redirect_off(cmd2_app): - text = '>file' - line = 'command {}'.format(text) - endidx = len(line) - begidx = endidx - len(text) - - cmd2_app.statement_parser.allow_redirection = False - expected_tokens = ['command', '>file'] - expected_raw_tokens = ['command', '>file'] - - tokens, raw_tokens = cmd2_app.tokens_for_completion(line, begidx, endidx) - assert expected_tokens == tokens - assert expected_raw_tokens == raw_tokens - def test_add_opening_quote_basic_no_text(cmd2_app): text = '' line = 'test_basic {}'.format(text) diff --git a/tests/test_history.py b/tests/test_history.py index 9752ed07..476cdd7e 100644..100755 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -268,7 +268,6 @@ def histitem(): def parser(): from cmd2.parsing import StatementParser parser = StatementParser( - allow_redirection=True, terminators=[';', '&'], multiline_commands=['multiline'], aliases={'helpalias': 'help', diff --git a/tests/test_parsing.py b/tests/test_parsing.py index a629d9fa..ac540183 100644..100755 --- a/tests/test_parsing.py +++ b/tests/test_parsing.py @@ -13,7 +13,6 @@ from cmd2.parsing import StatementParser, shlex_split @pytest.fixture def parser(): parser = StatementParser( - allow_redirection=True, terminators=[';', '&'], multiline_commands=['multiline'], aliases={'helpalias': 'help', |