Skip to content

Commit

Permalink
Small changes to get BigQuery tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
austinweisgrau committed May 23, 2024
1 parent 44941f7 commit 72e2bcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions parsons/google/google_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ def __init__(
if isinstance(app_creds, Credentials):
self.credentials = app_creds
else:
env_credential_path = str(uuid.uuid4())
setup_google_application_credentials(app_creds, target_env_var_name=env_credential_path)
self.credentials = load_google_application_credentials(env_credential_path)
self.env_credential_path = str(uuid.uuid4())
setup_google_application_credentials(
app_creds, target_env_var_name=self.env_credential_path
)
self.credentials = load_google_application_credentials(self.env_credential_path)

self.project = project
self.location = location
Expand Down
8 changes: 7 additions & 1 deletion test/test_databases/test_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@

from google.cloud import bigquery, exceptions

from parsons import GoogleBigQuery as BigQuery
from parsons import GoogleBigQuery
from parsons import Table
from parsons.google.google_cloud_storage import GoogleCloudStorage


class BigQuery(GoogleBigQuery):
@mock.patch("parsons.google.google_bigquery.load_google_application_credentials")
def __init__(self, load_creds_mock, app_creds=None, **kwargs):
super().__init__(app_creds=app_creds, **kwargs)


class FakeClient:
"""A Fake Storage Client used for monkey-patching."""

Expand Down

0 comments on commit 72e2bcf

Please sign in to comment.