#NEWLINE# def test_list_datasets_defaults( self ) : #NEWLINE# #INDENT# from gcloud.bigquery.dataset import Dataset #NEWLINE# PROJECT = 'PROJECT' #NEWLINE# DATASET_1 = 'dataset_one' #NEWLINE# DATASET_2 = 'dataset_two' #NEWLINE# PATH = ( 'projects/%s/datasets' % PROJECT ) #NEWLINE# TOKEN = 'TOKEN' #NEWLINE# DATA = { #NEWLINE# #INDENT# 'nextPageToken' : TOKEN , #NEWLINE# 'datasets' : [ { #NEWLINE# #INDENT# 'kind' : 'bigquery#dataset' , #NEWLINE# 'id' : ( '%s:%s' % ( PROJECT , DATASET_1 ) ) , #NEWLINE# 'datasetReference' : { #NEWLINE# #INDENT# 'datasetId' : DATASET_1 , #NEWLINE# 'projectId' : PROJECT , #NEWLINE# #UNINDENT# } , #NEWLINE# 'friendlyName' : None , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'kind' : 'bigquery#dataset' , #NEWLINE# 'id' : ( '%s:%s' % ( PROJECT , DATASET_2 ) ) , #NEWLINE# 'datasetReference' : { #NEWLINE# #INDENT# 'datasetId' : DATASET_2 , #NEWLINE# 'projectId' : PROJECT , #NEWLINE# #UNINDENT# } , #NEWLINE# 'friendlyName' : 'Two' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# creds = _Credentials ( ) #NEWLINE# client = self . _makeOne ( PROJECT , creds ) #NEWLINE# conn = client . connection = _Connection ( DATA ) #NEWLINE# ( datasets , token ) = client . list_datasets ( ) #NEWLINE# self . assertEqual ( len ( datasets ) , len ( DATA [ 'datasets' ] ) ) #NEWLINE# for ( found , expected ) in zip ( datasets , DATA [ 'datasets' ] ) : #NEWLINE# #INDENT# self . assertTrue ( isinstance ( found , Dataset ) ) #NEWLINE# self . assertEqual ( found . dataset_id , expected [ 'id' ] ) #NEWLINE# self . assertEqual ( found . friendly_name , expected [ 'friendlyName' ] ) #NEWLINE# #UNINDENT# self . assertEqual ( token , TOKEN ) #NEWLINE# self . assertEqual ( len ( conn . _requested ) , 1 ) #NEWLINE# req = conn . _requested [ 0 ] #NEWLINE# self . assertEqual ( req [ 'method' ] , 'GET' ) #NEWLINE# self . assertEqual ( req [ 'path' ] , ( '/%s' % PATH ) )