#NEWLINE# def testGetInstance( self ) : #NEWLINE# #INDENT# 'Unit test of GetInstance().' #NEWLINE# mock_api = MagicMock ( name = 'Mock Google Client API' ) #NEWLINE# self . gce_api . GetApi = MagicMock ( return_value = mock_api ) #NEWLINE# instance_info = self . gce_api . GetInstance ( 'instance-name' ) #NEWLINE# self . assertEqual ( 1 , self . gce_api . GetApi . call_count ) #NEWLINE# mock_api . instances . return_value . get . assert_called_once_with ( project = 'project-name' , zone = 'zone-name' , instance = 'instance-name' ) #NEWLINE# mock_api . instances . return_value . get . return_value . execute . assert_called_once_with ( ) #NEWLINE# self . assertEqual ( mock_api . instances . return_value . get . return_value . execute . return_value , instance_info )