#NEWLINE# @ mock . patch ( 'sahara.utils.ssh_remote._get_os_distrib' ) #NEWLINE# @ mock . patch ( 'sahara.utils.ssh_remote._execute_command' ) #NEWLINE# def test_install_packages( self , p_execute_command , p_get_os_distrib ) : #NEWLINE# #INDENT# packages = ( 'git' , 'emacs' , 'tree' ) #NEWLINE# p_get_os_distrib . return_value = 'ubuntu' #NEWLINE# ssh_remote . _install_packages ( p_execute_command ) #NEWLINE# p_execute_command . assert_called_with ( 'RUNLEVEL=1 apt-get install -y git emacs tree' , run_as_root = True ) #NEWLINE# p_get_os_distrib . return_value = 'centos' #NEWLINE# ssh_remote . _install_packages ( packages ) #NEWLINE# p_execute_command . assert_called_with ( 'yum install -y git emacs tree' , run_as_root = True ) #NEWLINE# p_get_os_distrib . return_value = 'fedora' #NEWLINE# ssh_remote . _install_packages ( packages ) #NEWLINE# p_execute_command . assert_called_with ( 'yum install -y git emacs tree' , run_as_root = True ) #NEWLINE# p_get_os_distrib . return_value = 'redhat' #NEWLINE# ssh_remote . _install_packages ( packages ) #NEWLINE# p_execute_command . assert_called_with ( 'yum install -y git emacs tree' , run_as_root = True )