mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Restore ansible --version output (#55728)
* Add custom action class for version info * Use args from CLI as prog for ArgumentParser object * Make prog a required parameter of create_base_parser() and update all uses to pass in the newly required parameter. * Add unit test for checking ansible --version * Update other related unit tests
This commit is contained in:
@@ -27,12 +27,12 @@ from ansible.cli.console import ConsoleCLI
|
||||
|
||||
class TestConsoleCLI(unittest.TestCase):
|
||||
def test_parse(self):
|
||||
cli = ConsoleCLI([])
|
||||
cli = ConsoleCLI(['ansible test'])
|
||||
cli.parse()
|
||||
self.assertTrue(cli.parser is not None)
|
||||
|
||||
def test_module_args(self):
|
||||
cli = ConsoleCLI([])
|
||||
cli = ConsoleCLI(['ansible test'])
|
||||
cli.parse()
|
||||
res = cli.module_args('copy')
|
||||
self.assertTrue(cli.parser is not None)
|
||||
@@ -42,7 +42,7 @@ class TestConsoleCLI(unittest.TestCase):
|
||||
|
||||
@patch('ansible.utils.display.Display.display')
|
||||
def test_helpdefault(self, mock_display):
|
||||
cli = ConsoleCLI([])
|
||||
cli = ConsoleCLI(['ansible test'])
|
||||
cli.parse()
|
||||
cli.modules = set(['copy'])
|
||||
cli.helpdefault('copy')
|
||||
|
||||
Reference in New Issue
Block a user