|
|
|
@ -20,6 +20,7 @@ from __future__ import (absolute_import, division, print_function)
|
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import pipes
|
|
|
|
|
|
|
|
|
|
from ansible.compat.tests import unittest
|
|
|
|
|
from ansible.compat.tests.mock import patch, MagicMock
|
|
|
|
@ -177,6 +178,11 @@ class TestPlayContext(unittest.TestCase):
|
|
|
|
|
cmd = play_context.make_become_cmd(cmd=default_cmd, executable="/bin/bash")
|
|
|
|
|
self.assertEqual(cmd, """%s -u %s %s -c 'echo %s; %s'""" % (dzdo_exe, play_context.become_user, default_exe, play_context.success_key, default_cmd))
|
|
|
|
|
|
|
|
|
|
play_context.become_pass = 'testpass'
|
|
|
|
|
play_context.become_method = 'dzdo'
|
|
|
|
|
cmd = play_context.make_become_cmd(cmd=default_cmd, executable="/bin/bash")
|
|
|
|
|
self.assertEqual(cmd, """%s -p %s -u %s %s -c 'echo %s; %s'""" % (dzdo_exe, pipes.quote(play_context.prompt), play_context.become_user, default_exe, play_context.success_key, default_cmd))
|
|
|
|
|
|
|
|
|
|
class TestTaskAndVariableOverrride(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
inventory_vars = (
|
|
|
|
|