1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 16:11:49 +00:00
hetzner.hcloud/tests/unit/module_utils/test_ssh.py
Jonas L. cfa0d181f7
refactor: mark module_utils modules as private (#782)
##### SUMMARY

All `module_utils` are now marked as **private**. None of the modules
were intended for public use.

Similar to
https://togithub.com/ansible-collections/community.general/issues/11312
2026-01-06 08:43:46 +01:00

28 lines
1.1 KiB
Python

from __future__ import annotations
import pytest
from plugins.module_utils._ssh import (
ssh_public_key_md5_fingerprint,
)
@pytest.mark.parametrize(
("public_key", "fingerprint"),
[
(
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNWUEdTk1oxrjUZ5erbKUmJM3VxQ9DLocgt/HFohCf6 comment",
"ce:cf:37:b9:38:40:ad:80:b2:8b:2c:5c:83:b5:af:0b",
),
(
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNWUEdTk1oxrjUZ5erbKUmJM3VxQ9DLocgt/HFohCf6", # No comment
"ce:cf:37:b9:38:40:ad:80:b2:8b:2c:5c:83:b5:af:0b",
),
(
"ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBABOUmmgxbhhauMg97GMwHcjWXM35MwFmlSKx7klWpPr3jMbabGQzINFVXexgf6Tru0D5a7NU/Hkx9t2yOtqKHJOIQB5/NKktqYelul4X56WYV/64RSm6xIjcolNao9fUbawnIwh9mvaQQg5v1BiJfPJ6p6LcWPunzfm6DztU1tHwLtjTw== comment", # noqa: E501
"bf:61:7b:7f:ab:c7:af:25:aa:d7:d5:e8:5f:87:5c:66",
),
],
)
def test_ssh_public_key_md5_fingerprint(public_key: str, fingerprint: str):
assert ssh_public_key_md5_fingerprint(public_key) == fingerprint