summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_user.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/unit/modules/network/vyos/test_vyos_user.py b/tests/unit/modules/network/vyos/test_vyos_user.py
index 0e60f07e..27ab1f38 100644
--- a/tests/unit/modules/network/vyos/test_vyos_user.py
+++ b/tests/unit/modules/network/vyos/test_vyos_user.py
@@ -18,6 +18,7 @@
# Make coding more python3-ish
from __future__ import absolute_import, division, print_function
+
__metaclass__ = type
from unittest.mock import patch
@@ -170,6 +171,39 @@ class TestVyosUserModule(TestVyosModule):
],
)
+ def test_vyos_user_set_security_keys(self):
+ set_module_args(
+ dict(
+ name="ansible",
+ public_keys=[
+ dict(
+ name="ecdsa@host",
+ key="AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY",
+ type="sk-ecdsa-sha2-nistp256@openssh.com",
+ ),
+ dict(
+ name="ed25519@host",
+ key="AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD",
+ type="sk-ssh-ed25519@openssh.com",
+ ),
+ ],
+ ),
+ )
+ result = self.execute_module(changed=True)
+ self.assertEqual(
+ result["commands"],
+ [
+ "set system login user ansible authentication public-keys "
+ "ecdsa@host key 'AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTY'",
+ "set system login user ansible authentication public-keys ecdsa@host "
+ "type 'sk-ecdsa-sha2-nistp256@openssh.com'",
+ "set system login user ansible authentication public-keys ed25519@host "
+ "key 'AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIFIR0jrMvBdmvTJNY5EDhOD'",
+ "set system login user ansible authentication public-keys ed25519@host "
+ "type 'sk-ssh-ed25519@openssh.com'",
+ ],
+ )
+
def test_vyos_user_set_ssh_key_idempotent(self):
set_module_args(
dict(