Added test case for the prompt argument to virtualenv_mod.

This commit is contained in:
Pedro Algarvio 2013-07-14 13:04:11 +01:00
parent 90df84fb27
commit 45c258e00b

View File

@ -331,6 +331,32 @@ class VirtualenvTestCase(TestCase):
runas=None
)
def test_prompt_argument(self):
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
with patch.dict(virtualenv_mod.__salt__, {'cmd.run_all': mock}):
virtualenv_mod.create('/tmp/foo', prompt='PY Prompt')
mock.assert_called_once_with(
'virtualenv --prompt=\'PY Prompt\' /tmp/foo',
runas=None
)
# Now with some quotes on the mix
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
with patch.dict(virtualenv_mod.__salt__, {'cmd.run_all': mock}):
virtualenv_mod.create('/tmp/foo', prompt='\'PY\' Prompt')
mock.assert_called_once_with(
'virtualenv --prompt="\'PY\' Prompt" /tmp/foo',
runas=None
)
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
with patch.dict(virtualenv_mod.__salt__, {'cmd.run_all': mock}):
virtualenv_mod.create('/tmp/foo', prompt='"PY" Prompt')
mock.assert_called_once_with(
'virtualenv --prompt=\'"PY" Prompt\' /tmp/foo',
runas=None
)
if __name__ == '__main__':
from integration import run_tests