#NEWLINE# @ mock . patch ( 'nova.image.glance._extract_query_params' ) #NEWLINE# @ mock . patch ( 'nova.image.glance._translate_from_glance' ) #NEWLINE# @ mock . patch ( 'nova.image.glance._is_image_available' ) #NEWLINE# def test_detail_success_available( self , is_avail_mock , trans_from_mock , ext_query_mock ) : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# is_avail_mock . return_value = True #NEWLINE# ext_query_mock . return_value = self #NEWLINE# trans_from_mock . return_value = mock . sentinel . trans_from #NEWLINE# client = mock . MagicMock ( ) #NEWLINE# client . call . return_value = [ mock . sentinel . images_0 ] #NEWLINE# ctx = mock . sentinel . ctx #NEWLINE# service = glance . GlanceImageService ( client ) #NEWLINE# images = service . detail ( ctx , ** params ) #NEWLINE# client . call . assert_called_once_with ( ctx , 1 , 'list' ) #NEWLINE# is_avail_mock . assert_called_once_with ( ctx , mock . sentinel . images_0 ) #NEWLINE# trans_from_mock . assert_called_once_with ( mock . sentinel . images_0 ) #NEWLINE# self . assertEqual ( [ mock . sentinel . trans_from ] , images )