#NEWLINE# def test_list_jobs_load_job_wo_sourceUris( self ) : #NEWLINE# #INDENT# from gcloud.bigquery.job import LoadTableFromStorageJob #NEWLINE# PROJECT = 'PROJECT' #NEWLINE# DATASET = 'test_dataset' #NEWLINE# SOURCE_TABLE = 'source_table' #NEWLINE# JOB_TYPES = { #NEWLINE# #INDENT# 'load_job' : LoadTableFromStorageJob , #NEWLINE# #UNINDENT# } #NEWLINE# PATH = ( 'projects/%s/jobs' % PROJECT ) #NEWLINE# TOKEN = 'TOKEN' #NEWLINE# LOAD_DATA = { #NEWLINE# #INDENT# 'id' : ( '%s:%s' % ( PROJECT , 'load_job' ) ) , #NEWLINE# 'jobReference' : { #NEWLINE# #INDENT# 'projectId' : PROJECT , #NEWLINE# 'jobId' : 'load_job' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'state' : 'DONE' , #NEWLINE# 'configuration' : { #NEWLINE# #INDENT# 'load' : { #NEWLINE# #INDENT# 'destinationTable' : { #NEWLINE# #INDENT# 'projectId' : PROJECT , #NEWLINE# 'datasetId' : DATASET , #NEWLINE# 'tableId' : SOURCE_TABLE , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# DATA = { #NEWLINE# #INDENT# 'nextPageToken' : TOKEN , #NEWLINE# 'jobs' : [ LOAD_DATA ] , #NEWLINE# #UNINDENT# } #NEWLINE# creds = _Credentials ( ) #NEWLINE# client = self . _makeOne ( PROJECT , creds ) #NEWLINE# conn = client . connection = _Connection ( DATA ) #NEWLINE# ( jobs , token ) = client . list_jobs ( ) #NEWLINE# self . assertEqual ( len ( jobs ) , len ( DATA [ 'jobs' ] ) ) #NEWLINE# for ( found , expected ) in zip ( jobs , DATA [ 'jobs' ] ) : #NEWLINE# #INDENT# name = expected [ 'jobReference' ] [ 'jobId' ] #NEWLINE# self . assertTrue ( isinstance ( found , JOB_TYPES [ SOURCE_TABLE ] ) ) #NEWLINE# self . assertEqual ( found . name , name ) #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 ) ) #NEWLINE# self . assertEqual ( req [ 'query_params' ] , { #NEWLINE# #INDENT# 'projection' : 'full' , #NEWLINE# #UNINDENT# } )