#NEWLINE# @ mock . patch . object ( six . moves . builtins , 'open' ) #NEWLINE# @ mock . patch ( 'nova.image.glance.GlanceImageService.show' ) #NEWLINE# def test_download_data_no_dest_path( self , show_mock , open_mock ) : #NEWLINE# #INDENT# client = mock . MagicMock ( ) #NEWLINE# client . call . return_value = [ 1 , 2 , 3 ] #NEWLINE# ctx = mock . sentinel . ctx #NEWLINE# data = mock . MagicMock ( ) #NEWLINE# service = glance . GlanceImageService ( client ) #NEWLINE# res = service . download ( ctx , mock . sentinel . image_id , data = data ) #NEWLINE# self . assertFalse ( show_mock . called ) #NEWLINE# self . assertFalse ( open_mock . called ) #NEWLINE# client . call . assert_called_once_with ( ctx , 1 , 'data' , mock . sentinel . image_id ) #NEWLINE# self . assertIsNone ( res ) #NEWLINE# data . write . assert_has_calls ( [ mock . call ( 1 ) , mock . call ( 2 ) , mock . call ( 3 ) ] ) #NEWLINE# self . assertFalse ( data . close . called )