mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
* Fixes #30281 Configure login prompt for eos_banner * Fix unit test * Fix pep8 issue
This commit is contained in:
parent
ec59650528
commit
3ff527b1d2
3 changed files with 29 additions and 7 deletions
|
@ -64,7 +64,7 @@ class AnsibleFailJson(Exception):
|
|||
|
||||
class TestEosModule(unittest.TestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False, transport='cli'):
|
||||
def execute_module(self, failed=False, changed=False, commands=None, inputs=None, sort=True, defaults=False, transport='cli'):
|
||||
|
||||
self.load_fixtures(commands, transport=transport)
|
||||
|
||||
|
@ -76,10 +76,24 @@ class TestEosModule(unittest.TestCase):
|
|||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
if transport == 'eapi':
|
||||
cmd = []
|
||||
value = []
|
||||
for item in result['commands']:
|
||||
cmd.append(item['cmd'])
|
||||
if 'input' in item:
|
||||
value.append(item['input'])
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(cmd), cmd)
|
||||
else:
|
||||
self.assertEqual(commands, cmd, cmd)
|
||||
if inputs:
|
||||
self.assertEqual(inputs, value, value)
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue