Skip to content

Commit

Permalink
feat(test): add tests for the current behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanix-Darker committed Oct 2, 2023
1 parent a982faf commit f4f4d45
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/google_big_query/test_google_big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,21 @@ def test_optional_fields_validator_for_google_creds_or_jwt():
}
# no error raised
_ = GoogleBigQueryConnector(name='something', jwt_credentials=valid_credentials)


def test_get_project_id(
connector: GoogleBigQueryConnector, _fixture_credentials: GoogleCredentials
) -> None:
# test get project id with jwt credentials
connector.jwt_credentials = JWTCredentials(jwt_token='token', project_id='123')
assert connector._get_project_id() == '123'

# test get project id with credentials
connector.jwt_credentials = None
connector.credentials = _fixture_credentials
connector.credentials.project_id = '456'
assert connector._get_project_id() == '456'

# On ProjectId missing...
with pytest.raises(GoogleClientCreationError):
connector._get_project_id()

0 comments on commit f4f4d45

Please sign in to comment.