mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 15:21:25 -07:00
fix prompt error when deleting ios user (#28175)
* fix prompt error when deleting ios user * placate pep8 * wrap delete user command in function * fix python 3 unit tests
This commit is contained in:
parent
ce3d1c6ba0
commit
a37c5e53e6
3 changed files with 51 additions and 8 deletions
|
@ -53,7 +53,17 @@ class TestIosUserModule(TestIosModule):
|
|||
def test_ios_user_delete(self):
|
||||
set_module_args(dict(name='ansible', state='absent'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['no username ansible'])
|
||||
cmd = json.loads(
|
||||
'{"answer": "y", ' +
|
||||
'"prompt": "This operation will remove all username related ' +
|
||||
'configurations with same name", "command": "no username ansible"}'
|
||||
)
|
||||
|
||||
result_cmd = []
|
||||
for i in result['commands']:
|
||||
result_cmd.append(json.loads(i))
|
||||
|
||||
self.assertEqual(result_cmd, [cmd])
|
||||
|
||||
def test_ios_user_password(self):
|
||||
set_module_args(dict(name='ansible', password='test'))
|
||||
|
@ -72,7 +82,17 @@ class TestIosUserModule(TestIosModule):
|
|||
def test_ios_user_purge(self):
|
||||
set_module_args(dict(purge=True))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['no username ansible'])
|
||||
cmd = json.loads(
|
||||
'{"answer": "y", ' +
|
||||
'"prompt": "This operation will remove all username related ' +
|
||||
'configurations with same name", "command": "no username ansible"}'
|
||||
)
|
||||
|
||||
result_cmd = []
|
||||
for i in result['commands']:
|
||||
result_cmd.append(json.loads(i))
|
||||
|
||||
self.assertEqual(result_cmd, [cmd])
|
||||
|
||||
def test_ios_user_view(self):
|
||||
set_module_args(dict(name='ansible', view='test'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue