#NEWLINE# def test_install( self ) : #NEWLINE# #INDENT# process = MagicMock ( ) #NEWLINE# process . communicate . return_value = ( '' , '' ) #NEWLINE# process . returncode = 0 #NEWLINE# self . popen . return_value = process #NEWLINE# self . ubuntu . install ( self . params ) #NEWLINE# self . popen . assert_has_calls ( [ call ( [ 'service' , 'codedeploy-agent' , 'stop' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) , call ( ) . communicate ( ) ] ) #NEWLINE# self . check_call . assert_has_calls ( [ call ( [ 'apt-get' , '-y' , 'update' ] ) , call ( [ 'apt-get' , '-y' , 'install' , 'ruby2.0' ] ) , call ( [ 'chmod' , '+x' , './{0}' . format ( self . installer ) ] ) , call ( [ './{0}' . format ( self . installer ) , 'auto' ] , env = self . environment ) ] ) #NEWLINE# self . open . assert_called_with ( self . installer , 'wb' ) #NEWLINE# self . open ( ) . write . assert_called_with ( process . body )