mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-22 00:49:09 -07:00
module should fail if eos_user is added without configured_password or nopassword or sshkey (#28780)
* module should fail if eos_user is added without configured_password or nopassword or sshkey Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix eos_user unit test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix eos_user integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
cef40cb54a
commit
252efcebf5
3 changed files with 41 additions and 11 deletions
|
@ -59,12 +59,12 @@ class TestEosUserModule(TestEosModule):
|
|||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_eos_user_privilege(self):
|
||||
set_module_args(dict(name='ansible', privilege=15))
|
||||
commands = ['username ansible privilege 15']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
set_module_args(dict(name='ansible', privilege=15, configured_password='test'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertIn('username ansible privilege 15', result['commands'])
|
||||
|
||||
def test_eos_user_privilege_invalid(self):
|
||||
set_module_args(dict(name='ansible', privilege=25))
|
||||
set_module_args(dict(name='ansible', privilege=25, configured_password='test'))
|
||||
self.execute_module(failed=True)
|
||||
|
||||
def test_eos_user_purge(self):
|
||||
|
@ -73,9 +73,9 @@ class TestEosUserModule(TestEosModule):
|
|||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_eos_user_role(self):
|
||||
set_module_args(dict(name='ansible', role='test'))
|
||||
commands = ['username ansible role test']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
set_module_args(dict(name='ansible', role='test', configured_password='test'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertIn('username ansible role test', result['commands'])
|
||||
|
||||
def test_eos_user_sshkey(self):
|
||||
set_module_args(dict(name='ansible', sshkey='test'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue