mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Be compatible with mock 0.7
This commit is contained in:
parent
9dd57c057e
commit
92ffbaba6e
@ -47,7 +47,8 @@ rvm rubies
|
||||
# * - default
|
||||
|
||||
'''
|
||||
with patch.object(rvm, '_rvm', return_value=list_output):
|
||||
with patch.object(rvm, '_rvm') as mock_method:
|
||||
mock_method.return_value = list_output
|
||||
self.assertEqual(
|
||||
[['jruby', '1.6.5.1', False],
|
||||
['ree', '1.8.7-2011.03', False],
|
||||
@ -66,7 +67,8 @@ gemsets for ree-1.8.7-2012.02 (found in /usr/local/rvm/gems/ree-1.8.7-2012.02)
|
||||
foo
|
||||
|
||||
'''
|
||||
with patch.object(rvm, '_rvm_do', return_value=output):
|
||||
with patch.object(rvm, '_rvm_do') as mock_method:
|
||||
mock_method.return_value = output
|
||||
self.assertEqual(
|
||||
['global', 'bar', 'foo'],
|
||||
rvm.gemset_list())
|
||||
@ -97,7 +99,8 @@ gemsets for ruby-1.9.2-p180 (found in /usr/local/rvm/gems/ruby-1.9.2-p180)
|
||||
|
||||
|
||||
'''
|
||||
with patch.object(rvm, '_rvm_do', return_value=output):
|
||||
with patch.object(rvm, '_rvm_do') as mock_method:
|
||||
mock_method.return_value = output
|
||||
self.assertEqual(
|
||||
{'jruby-1.6.5.1': ['global', 'jbar', 'jfoo'],
|
||||
'ruby-1.9.2-p180': ['global'],
|
||||
|
@ -54,8 +54,8 @@ class TestRvmState(TestCase):
|
||||
self.assertEqual(result, ret['result'])
|
||||
|
||||
def test_gemset_present(self):
|
||||
with patch.object(rvm, '_check_rvm',
|
||||
return_value={'result': True, 'changes': {}}):
|
||||
with patch.object(rvm, '_check_rvm') as mock_method:
|
||||
mock_method.return_value = {'result': True, 'changes': {}}
|
||||
gems = ['global', 'foo', 'bar']
|
||||
gemset_list = MagicMock(return_value=gems)
|
||||
gemset_create = MagicMock(return_value=True)
|
||||
@ -75,7 +75,8 @@ class TestRvmState(TestCase):
|
||||
|
||||
def test_installed(self):
|
||||
mock = MagicMock()
|
||||
with patch.object(rvm, '_check_rvm', return_value={'result': True}):
|
||||
with patch.object(rvm, '_check_rvm') as mock_method:
|
||||
mock_method.return_value = {'result': True}
|
||||
with patch.object(rvm, '_check_and_install_ruby', new=mock):
|
||||
rvm.installed("1.9.3", default=True)
|
||||
mock.assert_called_once_with(
|
||||
|
Loading…
Reference in New Issue
Block a user