mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
[PR #9842/c46575cf backport][stable-9] Simplify module_utils unit tests (#9843)
Simplify module_utils unit tests (#9842)
Simplify module_utils unit tests.
(cherry picked from commit c46575cf06
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
013fb9c006
commit
ba7439e657
2 changed files with 6 additions and 78 deletions
|
@ -93,11 +93,12 @@ def test_get_fqdn_and_port(url, fqdn, port):
|
|||
assert known_hosts.get_fqdn_and_port(url) == (fqdn, port)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('fqdn, port, add_host_key_cmd, stdin',
|
||||
((URLS[k]['get_fqdn'], URLS[k]['port'], URLS[k]['add_host_key_cmd'], {})
|
||||
for k in sorted(URLS) if URLS[k]['is_ssh_url']),
|
||||
indirect=['stdin'])
|
||||
def test_add_host_key(am, mocker, fqdn, port, add_host_key_cmd):
|
||||
@pytest.mark.parametrize('fqdn, port, add_host_key_cmd',
|
||||
((URLS[k]['get_fqdn'], URLS[k]['port'], URLS[k]['add_host_key_cmd'])
|
||||
for k in sorted(URLS) if URLS[k]['is_ssh_url']))
|
||||
def test_add_host_key(mocker, fqdn, port, add_host_key_cmd):
|
||||
am = mocker.MagicMock()
|
||||
|
||||
get_bin_path = mocker.MagicMock()
|
||||
get_bin_path.return_value = keyscan_cmd = "/custom/path/ssh-keyscan"
|
||||
am.get_bin_path = get_bin_path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue