#NEWLINE# def test_list( self ) : #NEWLINE# #INDENT# PROJECT = 'my-project' #NEWLINE# PATH = 'projects/{project}/metricDescriptors/' . format ( project = PROJECT ) #NEWLINE# TYPE1 = 'custom.googleapis.com/my-metric-1' #NEWLINE# DESCRIPTION1 = 'This is my first metric.' #NEWLINE# NAME1 = ( PATH + TYPE1 ) #NEWLINE# METRIC_DESCRIPTOR1 = { #NEWLINE# #INDENT# 'name' : NAME1 , #NEWLINE# 'type' : TYPE1 , #NEWLINE# 'metricKind' : 'GAUGE' , #NEWLINE# 'valueType' : 'DOUBLE' , #NEWLINE# 'description' : DESCRIPTION1 , #NEWLINE# #UNINDENT# } #NEWLINE# TYPE2 = 'custom.googleapis.com/my-metric-2' #NEWLINE# DESCRIPTION2 = 'This is my second metric.' #NEWLINE# NAME2 = ( PATH + TYPE2 ) #NEWLINE# METRIC_DESCRIPTOR2 = { #NEWLINE# #INDENT# 'name' : NAME2 , #NEWLINE# 'type' : TYPE2 , #NEWLINE# 'metricKind' : 'GAUGE' , #NEWLINE# 'valueType' : 'DOUBLE' , #NEWLINE# 'description' : DESCRIPTION2 , #NEWLINE# #UNINDENT# } #NEWLINE# RESPONSE = { #NEWLINE# #INDENT# 'metricDescriptors' : [ METRIC_DESCRIPTOR1 , METRIC_DESCRIPTOR2 ] , #NEWLINE# #UNINDENT# } #NEWLINE# connection = _Connection ( RESPONSE ) #NEWLINE# client = _Client ( project = PROJECT , connection = connection ) #NEWLINE# descriptors = self . _getTargetClass ( ) . _list ( client ) #NEWLINE# self . assertEqual ( len ( descriptors ) , 2 ) #NEWLINE# ( descriptor1 , descriptor2 ) = descriptors #NEWLINE# self . assertEqual ( descriptor1 . name , NAME1 ) #NEWLINE# self . assertEqual ( descriptor1 . type , TYPE1 ) #NEWLINE# self . assertEqual ( descriptor1 . description , DESCRIPTION1 ) #NEWLINE# self . assertEqual ( descriptor2 . name , NAME2 ) #NEWLINE# self . assertEqual ( descriptor2 . type , TYPE2 ) #NEWLINE# self . assertEqual ( descriptor2 . description , DESCRIPTION2 ) #NEWLINE# ( request , ) = connection . _requested #NEWLINE# expected_request = { #NEWLINE# #INDENT# 'method' : 'GET' , #NEWLINE# 'path' : ( '/' + PATH ) , #NEWLINE# 'query_params' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( request , expected_request )