add test for first net cred ssh password protected wins

This commit is contained in:
chris meyers 2018-08-09 13:32:42 -04:00
parent 2f49dc774a
commit 40d6c763b3

View File

@ -788,6 +788,23 @@ class TestJobCredentials(TestJobExecution):
assert 'secret' in call_kwargs.get('expect_passwords').values()
def test_net_first_ssh_key_unlock_wins(self):
for i in range(3):
net = CredentialType.defaults['net']()
credential = Credential(
pk=1,
credential_type=net,
inputs = {'ssh_key_unlock': 'secret{}'.format(i)}
)
credential.inputs['ssh_key_unlock'] = encrypt_field(credential, 'ssh_key_unlock')
self.instance.credentials.add(credential)
self.task.run(self.pk)
assert self.run_pexpect.call_count == 1
call_args, call_kwargs = self.run_pexpect.call_args_list[0]
assert 'secret0' in call_kwargs.get('expect_passwords').values()
def test_prefer_ssh_over_net_ssh_key_unlock(self):
net = CredentialType.defaults['net']()
net_credential = Credential(