#NEWLINE# def test__check_and_install_ruby( self ) : #NEWLINE# #INDENT# mock_check_rvm = MagicMock ( return_value = { #NEWLINE# #INDENT# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'result' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# mock_check_ruby = MagicMock ( return_value = { #NEWLINE# #INDENT# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'result' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# mock_install_ruby = MagicMock ( return_value = '' ) #NEWLINE# with patch . object ( rvm , '_check_rvm' , new = self ) : #NEWLINE# #INDENT# with patch . object ( rvm , '_check_ruby' , new = mock_check_ruby ) : #NEWLINE# #INDENT# with patch . dict ( rvm . __salt__ , { #NEWLINE# #INDENT# 'rvm.install_ruby' : mock_install_ruby , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# rvm . _check_and_install_ruby ( { #NEWLINE# #INDENT# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , '1.9.3' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# mock_install_ruby . assert_called_once_with ( '1.9.3' , runas = None )