@@ -297,7 +297,9 @@ def test_query(self):
297297
298298 mock_query_job .execute .return_value = {
299299 'jobReference' : expected_job_ref ,
300- 'jobComplete' : True
300+ 'jobComplete' : True ,
301+ 'cacheHit' : False ,
302+ 'totalBytesProcessed' : 0
301303 }
302304
303305 self .mock_job_collection .query .return_value = mock_query_job
@@ -329,6 +331,8 @@ def test_query_max_results_set(self):
329331 mock_query_job .execute .return_value = {
330332 'jobReference' : expected_job_ref ,
331333 'jobComplete' : True ,
334+ 'cacheHit' : False ,
335+ 'totalBytesProcessed' : 0
332336 }
333337
334338 self .mock_job_collection .query .return_value = mock_query_job
@@ -357,6 +361,8 @@ def test_query_timeout_set(self):
357361 mock_query_job .execute .return_value = {
358362 'jobReference' : expected_job_ref ,
359363 'jobComplete' : True ,
364+ 'cacheHit' : False ,
365+ 'totalBytesProcessed' : 0
360366 }
361367
362368 self .mock_job_collection .query .return_value = mock_query_job
@@ -382,6 +388,8 @@ def test_sync_query_timeout(self):
382388 mock_query_job .execute .return_value = {
383389 'jobReference' : expected_job_ref ,
384390 'jobComplete' : False ,
391+ 'cacheHit' : False ,
392+ 'totalBytesProcessed' : 0
385393 }
386394
387395 self .mock_job_collection .query .return_value = mock_query_job
@@ -400,6 +408,8 @@ def test_async_query_timeout(self):
400408 mock_query_job .execute .return_value = {
401409 'jobReference' : expected_job_ref ,
402410 'jobComplete' : False ,
411+ 'cacheHit' : False ,
412+ 'totalBytesProcessed' : 0
403413 }
404414
405415 self .mock_job_collection .query .return_value = mock_query_job
@@ -409,14 +419,18 @@ def test_async_query_timeout(self):
409419 self .assertEquals (results , [])
410420
411421 def test_query_dry_run_valid (self ):
412- """Ensure that None and an empty list is returned from the query when
422+ """Ensure that None and [cacheHit, totalBytesProcessed] is returned from the query when
413423 dry_run is True and the query is valid.
414424 """
415425
416426 mock_query_job = mock .Mock ()
417427
418- mock_query_job .execute .return_value = {'jobReference' : {},
419- 'jobComplete' : True }
428+ mock_query_job .execute .return_value = {
429+ 'jobReference' : {},
430+ 'jobComplete' : True ,
431+ 'cacheHit' : False ,
432+ 'totalBytesProcessed' : 0
433+ }
420434
421435 self .mock_job_collection .query .return_value = mock_query_job
422436
@@ -428,7 +442,7 @@ def test_query_dry_run_valid(self):
428442 'dryRun' : True }
429443 )
430444 self .assertIsNone (job_id )
431- self .assertEqual ([], results )
445+ self .assertEqual ([False , 0 ], results )
432446
433447 def test_query_dry_run_invalid (self ):
434448 """Ensure that None and a dict is returned from the query when dry_run
@@ -468,6 +482,8 @@ def test_query_with_results(self):
468482 'schema' : {'fields' : [{'name' : 'foo' , 'type' : 'INTEGER' }]},
469483 'rows' : [{'f' : [{'v' : 10 }]}],
470484 'jobComplete' : True ,
485+ 'cacheHit' : False ,
486+ 'totalBytesProcessed' : 0
471487 }
472488
473489 self .mock_job_collection .query .return_value = mock_query_job
@@ -491,7 +507,9 @@ def test_query_with_using_legacy_sql(self):
491507
492508 mock_query_job .execute .return_value = {
493509 'jobReference' : expected_job_ref ,
494- 'jobComplete' : True
510+ 'jobComplete' : True ,
511+ 'cacheHit' : False ,
512+ 'totalBytesProcessed' : 0
495513 }
496514
497515 self .mock_job_collection .query .return_value = mock_query_job
@@ -873,7 +891,7 @@ def test_json_job_body_constructed_correctly(self):
873891 body = {
874892 "jobReference" : {
875893 "projectId" : self .project_id ,
876- "jobId" : "job"
894+ "jobId" : "job" ,
877895 },
878896 "configuration" : {
879897 "load" : {
0 commit comments