mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 19:20:22 -07:00
Simplify module_utils unit tests (#9842)
Simplify module_utils unit tests.
This commit is contained in:
parent
a1781d09dd
commit
c46575cf06
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