From 9a199b99ace041bca6268d63195fc89b8d41123b Mon Sep 17 00:00:00 2001 From: chris meyers Date: Thu, 9 Aug 2018 12:40:33 -0400 Subject: [PATCH] add pexpect test for net cred --- awx/main/tests/unit/test_tasks.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/awx/main/tests/unit/test_tasks.py b/awx/main/tests/unit/test_tasks.py index 830c3577fd..c9270bc2c1 100644 --- a/awx/main/tests/unit/test_tasks.py +++ b/awx/main/tests/unit/test_tasks.py @@ -772,6 +772,22 @@ class TestJobCredentials(TestJobExecution): if expected_flag: assert expected_flag in ' '.join(args) + def test_net_password(self): + net = CredentialType.defaults['net']() + credential = Credential( + pk=1, + credential_type=net, + inputs = {'username': 'bob', 'ssh_key_unlock': 'secret'} + ) + 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 'secret' in call_kwargs.get('expect_passwords').values() + def test_vault_password(self): vault = CredentialType.defaults['vault']() credential = Credential(