Skip to content

Commit

Permalink
Update error in system tests that expect error for wrong location (#7…
Browse files Browse the repository at this point in the history
…286)

We used to get BadRequest for querying with the wrong location. Now we
get NotFound. I update the test to just look for the base class of
GoogleAPICallError, since it seems we aren't guarnteed the actual status
code.
  • Loading branch information
tswast authored Feb 4, 2019
1 parent 20c6d16 commit 4d42061
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from google.api_core.exceptions import BadRequest
from google.api_core.exceptions import Conflict
from google.api_core.exceptions import Forbidden
from google.api_core.exceptions import GoogleAPICallError
from google.api_core.exceptions import NotFound
from google.api_core.exceptions import InternalServerError
from google.api_core.exceptions import ServiceUnavailable
Expand Down Expand Up @@ -765,17 +766,17 @@ def test_load_table_from_file_w_explicit_location(self):
self.assertTrue(eu_query.done)

# Cannot query from US.
with self.assertRaises(BadRequest):
with self.assertRaises(GoogleAPICallError):
list(client.query(query_string, location="US", job_config=query_config))

# Cannot copy from US.
with self.assertRaises(BadRequest):
with self.assertRaises(GoogleAPICallError):
client.copy_table(
table_ref, dataset.table("letters2_us"), location="US"
).result()

# Cannot extract from US.
with self.assertRaises(BadRequest):
with self.assertRaises(GoogleAPICallError):
client.extract_table(
table_ref, "gs://{}/letters-us.csv".format(bucket_name), location="US"
).result()
Expand Down

0 comments on commit 4d42061

Please sign in to comment.