Skip to content

Commit

Permalink
Fix quoting of test expression by replacing ' with "
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Manschwetus committed Dec 12, 2021
1 parent 0587811 commit 29027b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/unit/plugins/become/test_pfexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_pfexec_basic(mocker, parser, reset_cli_args):
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
print(cmd)
assert re.match('''%s %s echo %s; %s''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None


def test_pfexec(mocker, parser, reset_cli_args):
Expand All @@ -53,7 +53,7 @@ def test_pfexec(mocker, parser, reset_cli_args):
var_options = {}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
print(cmd)
assert re.match('''%s %s 'echo %s; %s' ''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None


def test_pfexec_varoptions(mocker, parser, reset_cli_args):
Expand All @@ -78,4 +78,4 @@ def test_pfexec_varoptions(mocker, parser, reset_cli_args):
}
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
print(cmd)
assert re.match('''%s %s 'echo %s; %s' ''' % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None
assert re.match("""%s %s 'echo %s; %s'""" % (pfexec_exe, pfexec_flags, success, default_cmd), cmd) is not None

0 comments on commit 29027b8

Please sign in to comment.