mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Reformat everything.
This commit is contained in:
@@ -20,13 +20,13 @@ def test_pbrun_basic(mocker, parser, reset_cli_args):
|
||||
|
||||
default_cmd = "/bin/foo"
|
||||
default_exe = "/bin/bash"
|
||||
pbrun_exe = 'pbrun'
|
||||
pbrun_flags = ''
|
||||
pbrun_exe = "pbrun"
|
||||
pbrun_flags = ""
|
||||
|
||||
success = 'BECOME-SUCCESS-.+?'
|
||||
success = "BECOME-SUCCESS-.+?"
|
||||
|
||||
task = {
|
||||
'become_method': 'community.general.pbrun',
|
||||
"become_method": "community.general.pbrun",
|
||||
}
|
||||
var_options = {}
|
||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||
@@ -40,20 +40,23 @@ def test_pbrun(mocker, parser, reset_cli_args):
|
||||
|
||||
default_cmd = "/bin/foo"
|
||||
default_exe = "/bin/bash"
|
||||
pbrun_exe = 'pbrun'
|
||||
pbrun_flags = ''
|
||||
pbrun_exe = "pbrun"
|
||||
pbrun_flags = ""
|
||||
|
||||
success = 'BECOME-SUCCESS-.+?'
|
||||
success = "BECOME-SUCCESS-.+?"
|
||||
|
||||
task = {
|
||||
'become_user': 'foo',
|
||||
'become_method': 'community.general.pbrun',
|
||||
'become_flags': pbrun_flags,
|
||||
"become_user": "foo",
|
||||
"become_method": "community.general.pbrun",
|
||||
"become_flags": pbrun_flags,
|
||||
}
|
||||
var_options = {}
|
||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||
print(cmd)
|
||||
assert re.match(f"""{pbrun_exe} {pbrun_flags} -u {task['become_user']} 'echo {success}; {default_cmd}'""", cmd) is not None
|
||||
assert (
|
||||
re.match(f"""{pbrun_exe} {pbrun_flags} -u {task["become_user"]} 'echo {success}; {default_cmd}'""", cmd)
|
||||
is not None
|
||||
)
|
||||
|
||||
|
||||
def test_pbrun_var_varoptions(mocker, parser, reset_cli_args):
|
||||
@@ -62,20 +65,26 @@ def test_pbrun_var_varoptions(mocker, parser, reset_cli_args):
|
||||
|
||||
default_cmd = "/bin/foo"
|
||||
default_exe = "/bin/bash"
|
||||
pbrun_exe = 'pbrun'
|
||||
pbrun_flags = ''
|
||||
pbrun_exe = "pbrun"
|
||||
pbrun_flags = ""
|
||||
|
||||
success = 'BECOME-SUCCESS-.+?'
|
||||
success = "BECOME-SUCCESS-.+?"
|
||||
|
||||
task = {
|
||||
'become_user': 'foo',
|
||||
'become_method': 'community.general.pbrun',
|
||||
'become_flags': 'xxx',
|
||||
"become_user": "foo",
|
||||
"become_method": "community.general.pbrun",
|
||||
"become_flags": "xxx",
|
||||
}
|
||||
var_options = {
|
||||
'ansible_become_user': 'bar',
|
||||
'ansible_become_flags': pbrun_flags,
|
||||
"ansible_become_user": "bar",
|
||||
"ansible_become_flags": pbrun_flags,
|
||||
}
|
||||
cmd = call_become_plugin(task, var_options, cmd=default_cmd, executable=default_exe)
|
||||
print(cmd)
|
||||
assert re.match(f"""{pbrun_exe} {pbrun_flags} -u {var_options['ansible_become_user']} 'echo {success}; {default_cmd}'""", cmd) is not None
|
||||
assert (
|
||||
re.match(
|
||||
f"""{pbrun_exe} {pbrun_flags} -u {var_options["ansible_become_user"]} 'echo {success}; {default_cmd}'""",
|
||||
cmd,
|
||||
)
|
||||
is not None
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user