mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Update rvm unit tests to reflect changes in execution module
This commit is contained in:
parent
0210ef4434
commit
aef6c39c04
@ -22,19 +22,27 @@ rvm.__salt__ = {
|
|||||||
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
@skipIf(NO_MOCK, NO_MOCK_REASON)
|
||||||
class TestRvmModule(TestCase):
|
class TestRvmModule(TestCase):
|
||||||
|
|
||||||
def test__rvm(self):
|
def test_rvm(self):
|
||||||
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
|
||||||
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
||||||
rvm._rvm('install', '1.9.3')
|
rvm._rvm(['install', '1.9.3'])
|
||||||
mock.assert_called_once_with(
|
mock.assert_called_once_with(
|
||||||
'/usr/local/rvm/bin/rvm install 1.9.3', runas=None, cwd=None
|
['/usr/local/rvm/bin/rvm', 'install', '1.9.3'],
|
||||||
|
runas=None,
|
||||||
|
cwd=None,
|
||||||
|
python_shell=False
|
||||||
)
|
)
|
||||||
|
|
||||||
def test__rvm_do(self):
|
def test_rvm_do(self):
|
||||||
mock = MagicMock(return_value={'retcode': 0, 'stdout': 'stdout'})
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': 'stdout'})
|
||||||
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
||||||
rvm._rvm_do('1.9.3', 'gemset list')
|
rvm._rvm_do('1.9.3', ['gemset', 'list'])
|
||||||
mock.assert_called_once_with('/usr/local/rvm/bin/rvm 1.9.3 do gemset list', runas=None, cwd=None)
|
mock.assert_called_once_with(
|
||||||
|
['/usr/local/rvm/bin/rvm', '1.9.3', 'do', 'gemset', 'list'],
|
||||||
|
runas=None,
|
||||||
|
cwd=None,
|
||||||
|
python_shell=False
|
||||||
|
)
|
||||||
|
|
||||||
def test_install(self):
|
def test_install(self):
|
||||||
mock = MagicMock(return_value={'retcode': 0})
|
mock = MagicMock(return_value={'retcode': 0})
|
||||||
@ -45,8 +53,20 @@ class TestRvmModule(TestCase):
|
|||||||
def test_install_ruby_nonroot(self):
|
def test_install_ruby_nonroot(self):
|
||||||
mock = MagicMock(return_value={'retcode': 0, 'stdout': 'stdout'})
|
mock = MagicMock(return_value={'retcode': 0, 'stdout': 'stdout'})
|
||||||
expected = [
|
expected = [
|
||||||
call('/usr/local/rvm/bin/rvm autolibs disable 2.0.0', runas='rvm', cwd=None),
|
call(
|
||||||
call('/usr/local/rvm/bin/rvm install --disable-binary 2.0.0', runas='rvm', cwd=None)]
|
['/usr/local/rvm/bin/rvm', 'autolibs', 'disable', '2.0.0'],
|
||||||
|
runas='rvm',
|
||||||
|
cwd=None,
|
||||||
|
python_shell=False
|
||||||
|
),
|
||||||
|
call(
|
||||||
|
['/usr/local/rvm/bin/rvm', 'install',
|
||||||
|
'--disable-binary', '2.0.0'],
|
||||||
|
runas='rvm',
|
||||||
|
cwd=None,
|
||||||
|
python_shell=False
|
||||||
|
)
|
||||||
|
]
|
||||||
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
with patch.dict(rvm.__salt__, {'cmd.run_all': mock}):
|
||||||
rvm.install_ruby('2.0.0', runas='rvm')
|
rvm.install_ruby('2.0.0', runas='rvm')
|
||||||
self.assertEqual(mock.call_args_list, expected)
|
self.assertEqual(mock.call_args_list, expected)
|
||||||
|
Loading…
Reference in New Issue
Block a user