mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
8ef2e6da05
* Add support for Windows hosts in the SSH connection plugin * fix Python 2.6 unit test and sanity issues * fix up connection tests in CI, disable SCP for now * ensure we don't pollute the existing environment during the test * Add connection_windows_ssh to classifier * use test dir for inventory file * Required powershell as default shell and fix tests * Remove exlicit become_methods on connection * clarify console encoding comment * ignore recent SCP errors in integration tests * Add cmd shell type and added more tests * Fix some doc issues * revises windows faq * add anchors for windows links * revises windows setup page * Update changelogs/fragments/windows-ssh.yaml Co-Authored-By: jborean93 <jborean93@gmail.com>
16 lines
457 B
Python
16 lines
457 B
Python
import pytest
|
|
|
|
from ansible.plugins.shell.cmd import ShellModule
|
|
|
|
|
|
@pytest.mark.parametrize('s, expected', [
|
|
['arg1', 'arg1'],
|
|
[None, '""'],
|
|
['arg1 and 2', '^"arg1 and 2^"'],
|
|
['malicious argument\\"&whoami', '^"malicious argument\\^"^&whoami^"'],
|
|
['C:\\temp\\some ^%file% > nul', '^"C:\\temp\\some ^^^%file^% ^> nul^"']
|
|
])
|
|
def test_quote_args(s, expected):
|
|
cmd = ShellModule()
|
|
actual = cmd.quote(s)
|
|
assert actual == expected
|