diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-07-15 22:59:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-15 22:59:54 -0400 |
commit | 9bbebbd312dbe0331510f39cd6de70f4d9dcefa8 (patch) | |
tree | ef224bb15175be33c5fff45cf3b2dcfbb6b04471 /tests/test_cmd2.py | |
parent | ab3a01517a18582d1bcd35d728482e73ac707b20 (diff) | |
parent | 94b424e9c41f99c6eb268c6c97f09e99a8342de8 (diff) | |
download | cmd2-git-9bbebbd312dbe0331510f39cd6de70f4d9dcefa8.tar.gz |
Merge branch 'master' into migrating_docs
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r-- | tests/test_cmd2.py | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index 9ffe547a..1bdbea5f 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1504,22 +1504,33 @@ invalid_command_name = [ 'noembedded"quotes', ] -def test_get_alias_names(base_app): - assert len(base_app.aliases) == 0 +def test_get_alias_completion_items(base_app): run_cmd(base_app, 'alias create fake run_pyscript') run_cmd(base_app, 'alias create ls !ls -hal') - assert len(base_app.aliases) == 2 - assert sorted(base_app._get_alias_names()) == ['fake', 'ls'] -def test_get_macro_names(base_app): - assert len(base_app.macros) == 0 + results = base_app._get_alias_completion_items() + assert len(results) == len(base_app.aliases) + + for cur_res in results: + assert cur_res in base_app.aliases + assert cur_res.description == base_app.aliases[cur_res] + +def test_get_macro_completion_items(base_app): run_cmd(base_app, 'macro create foo !echo foo') run_cmd(base_app, 'macro create bar !echo bar') - assert len(base_app.macros) == 2 - assert sorted(base_app._get_macro_names()) == ['bar', 'foo'] -def test_get_settable_names(base_app): - assert sorted(base_app._get_settable_names()) == sorted(base_app.settable.keys()) + results = base_app._get_macro_completion_items() + assert len(results) == len(base_app.macros) + + for cur_res in results: + assert cur_res in base_app.macros + assert cur_res.description == base_app.macros[cur_res].value + +def test_get_settable_completion_items(base_app): + results = base_app._get_settable_completion_items() + for cur_res in results: + assert cur_res in base_app.settable + assert cur_res.description == base_app.settable[cur_res] def test_alias_no_subcommand(base_app): out, err = run_cmd(base_app, 'alias') |