From aef6c39c04ce23f04ea3bb714b62b730a4e881d1 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Wed, 30 Sep 2015 16:12:44 -0500 Subject: [PATCH] Update rvm unit tests to reflect changes in execution module --- tests/unit/modules/rvm_test.py | 36 ++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/tests/unit/modules/rvm_test.py b/tests/unit/modules/rvm_test.py index 35ee4eaace..eb6b4cc1da 100644 --- a/tests/unit/modules/rvm_test.py +++ b/tests/unit/modules/rvm_test.py @@ -22,19 +22,27 @@ rvm.__salt__ = { @skipIf(NO_MOCK, NO_MOCK_REASON) class TestRvmModule(TestCase): - def test__rvm(self): + def test_rvm(self): mock = MagicMock(return_value={'retcode': 0, 'stdout': ''}) 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( - '/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'}) with patch.dict(rvm.__salt__, {'cmd.run_all': mock}): - 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) + 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, + python_shell=False + ) def test_install(self): mock = MagicMock(return_value={'retcode': 0}) @@ -45,8 +53,20 @@ class TestRvmModule(TestCase): def test_install_ruby_nonroot(self): mock = MagicMock(return_value={'retcode': 0, 'stdout': 'stdout'}) expected = [ - call('/usr/local/rvm/bin/rvm autolibs disable 2.0.0', runas='rvm', cwd=None), - call('/usr/local/rvm/bin/rvm install --disable-binary 2.0.0', runas='rvm', cwd=None)] + call( + ['/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}): rvm.install_ruby('2.0.0', runas='rvm') self.assertEqual(mock.call_args_list, expected)