def test___init__options_jump_host(self, mock_options): executor.AnsibleRunner( remote_user='******', jump_host='jhost.com', private_key_file='/path/my.key', ) module_path = executor.resolve_relative_path( 'os_faults/ansible/modules') mock_options.assert_called_once_with( become=None, become_method='sudo', become_user='******', check=False, connection='smart', forks=100, module_path=module_path, password=None, private_key_file='/path/my.key', remote_user='******', scp_extra_args=None, sftp_extra_args=None, ssh_common_args=('-o UserKnownHostsFile=/dev/null ' '-o StrictHostKeyChecking=no ' '-o ProxyCommand=' '"ssh -i /path/my.key ' '-W %h:%p ' '-o UserKnownHostsFile=/dev/null ' '-o StrictHostKeyChecking=no ' '*****@*****.**"'), ssh_extra_args=None, verbosity=100)
def test___init__options(self, config, options_args, passwords, mock_options): runner = executor.AnsibleRunner(**config) module_path = executor.resolve_relative_path( 'os_faults/ansible/modules') mock_options.assert_called_once_with(module_path=module_path, **options_args) self.assertEqual(passwords, runner.passwords)
def test___init__options(self, mock_options): executor.AnsibleRunner() module_path = executor.resolve_relative_path( 'os_faults/ansible/modules') mock_options.assert_called_once_with( become=None, become_method='sudo', become_user='******', check=False, connection='smart', forks=100, module_path=module_path, password=None, private_key_file=None, remote_user='******', scp_extra_args=None, sftp_extra_args=None, ssh_common_args=executor.SSH_COMMON_ARGS, ssh_extra_args=None, verbosity=100)
def test_resolve_relative_path_exists(self, mock_exist): mock_exist.return_value = True r = executor.resolve_relative_path('') self.assertIsNotNone(r)
def test_resolve_relative_path_doesnt_exist(self, mock_exist): mock_exist.return_value = False r = executor.resolve_relative_path('') self.assertIsNone(r)