File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -179,10 +179,10 @@ def get_application_default_credentials(self):
179
179
return None
180
180
# Check if the application has rights to the BigQuery project
181
181
bigquery_service = build ('bigquery' , 'v2' , credentials = credentials )
182
- job_collection = bigquery_service .jobs ()
182
+ jobs = bigquery_service .jobs ()
183
183
job_data = {'configuration' : {'query' : {'query' : 'SELECT 1' }}}
184
184
try :
185
- job_collection .insert (projectId = self .project_id , body = job_data ).execute ()
185
+ jobs .insert (projectId = self .project_id , body = job_data ).execute ()
186
186
except (AccessTokenRefreshError , HttpError ):
187
187
return None
188
188
return credentials
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ def _test_imports():
83
83
from oauth2client .client import GoogleCredentials # noqa
84
84
from oauth2client .client import OAuth2WebServerFlow # noqa
85
85
from oauth2client .client import AccessTokenRefreshError # noqa
86
- from oauth2client .client import ApplicationDefaultCredentialsError # noqa
86
+ from oauth2client .client import ApplicationDefaultCredentialsError # noqa
87
87
88
88
from oauth2client .file import Storage # noqa
89
89
from oauth2client .tools import run_flow # noqa
@@ -219,10 +219,11 @@ def test_should_be_able_to_get_results_from_query(self):
219
219
schema , pages = self .sut .run_query ('SELECT 1' )
220
220
self .assertTrue (pages is not None )
221
221
222
- def test_should_be_able_to_get_a_bigquery_service_from_default_credentials (self ):
222
+ def test_should_be_able_to_get_credentials_from_default_credentials (self ):
223
223
from oauth2client .client import GoogleCredentials
224
224
credentials = self .sut .get_application_default_credentials ()
225
- self .assertTrue (isinstance (credentials , (type (None ), GoogleCredentials )))
225
+ valid_types = (type (None ), GoogleCredentials )
226
+ self .assertTrue (isinstance (credentials , valid_types ))
226
227
227
228
228
229
class TestGBQConnectorServiceAccountKeyPathIntegration (tm .TestCase ):
You can’t perform that action at this time.
0 commit comments