mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
Fix error on 'help module' in ansible-console (#19390)
If 'help xattr' for example, ansible-console would traceback because module_docs.get_docstring() now returns 4 values (module metadata was added)
This commit is contained in:
parent
ebf835045f
commit
727ca6f436
2 changed files with 22 additions and 3 deletions
|
@ -20,6 +20,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from ansible.compat.tests.mock import patch
|
||||
|
||||
from ansible.cli.console import ConsoleCLI
|
||||
|
||||
|
@ -30,3 +31,21 @@ class TestConsoleCLI(unittest.TestCase):
|
|||
cli.parse()
|
||||
self.assertTrue(cli.parser is not None)
|
||||
|
||||
def test_module_args(self):
|
||||
cli = ConsoleCLI([])
|
||||
cli.parse()
|
||||
res = cli.module_args('copy')
|
||||
self.assertTrue(cli.parser is not None)
|
||||
self.assertIn('src', res)
|
||||
self.assertIn('backup', res)
|
||||
self.assertIsInstance(res, list)
|
||||
|
||||
@patch('ansible.utils.display.Display.display')
|
||||
def test_helpdefault(self, mock_display):
|
||||
cli = ConsoleCLI([])
|
||||
cli.parse()
|
||||
cli.modules = set(['copy'])
|
||||
cli.helpdefault('copy')
|
||||
self.assertTrue(cli.parser is not None)
|
||||
self.assertTrue(len(mock_display.call_args_list) > 0,
|
||||
"display.display should have been called but was not")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue