def test_target_configure(config_files, monkeypatch, capsys):
def fakerun(*popenargs, **kwargs):
if get_command(popenargs) == "ansible-playbook":
return subprocess.CompletedProcess("fakerun", 0, '')
else:
print('Passthrough: {}'.format(get_command(popenargs)))
return subprocess.run(*popenargs, **kwargs)
monkeypatch.setattr(mockablerun, 'run_mockable', fakerun)
suppress_chown_during_debuild(monkeypatch)
with workspace():
edi_exec = os.path.join(get_project_root(), 'bin', 'edi')
project_name = 'pytest-{}'.format(get_random_string(6))
config_command = [edi_exec, 'config', 'init', project_name, 'debian-jessie-amd64']
run(config_command) # run as non root
parser = edi._setup_command_line_interface()
cli_args = parser.parse_args(['target', 'configure', 'remote-target', '{}-develop.yml'.format(project_name)])
Configure().run_cli(cli_args)
out, err = capsys.readouterr()
print(out)
assert not err
评论列表
文章目录