diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-12-17 23:15:56 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-12-17 23:15:56 -0500 |
commit | 189df5538bf86ef33766fa18852270a9a3e0b281 (patch) | |
tree | 991640021ff6303b7096c6aba79db215d1f769db /tests | |
parent | d91943f4ddbfcc47b35f26883e1068d5693c0f03 (diff) | |
download | cmd2-git-189df5538bf86ef33766fa18852270a9a3e0b281.tar.gz |
Updating unit tests
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_cmd2.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 2739fd1a..9a0218f2 100755 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -2360,6 +2360,21 @@ def test_startup_script(request): assert 'alias create ls' in out[0] +@pytest.mark.parametrize('startup_script', odd_file_names) +def test_startup_script_with_odd_file_names(startup_script): + """Test file names with various patterns""" + # Mock os.path.exists to trick cmd2 into adding this script to its startup commands + saved_exists = os.path.exists + os.path.exists = mock.MagicMock(name='exists', return_value=True) + + app = cmd2.Cmd(allow_cli_args=False, startup_script=startup_script) + assert len(app._startup_commands) == 1 + assert app._startup_commands[0] == "run_script {}".format(utils.quote_string(os.path.abspath(startup_script))) + + # Restore os.path.exists + os.path.exists = saved_exists + + def test_transcripts_at_init(): transcript_files = ['foo', 'bar'] app = cmd2.Cmd(allow_cli_args=False, transcript_files=transcript_files) |