Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs.gdrive: Fix GDRIVE_CREDENTIALS_DATA for service accounts #7213

Merged
merged 3 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dvc/fs/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def _validate_config(self):
if (
self._use_service_account
and not self._service_account_json_file_path
and GDriveFileSystem.GDRIVE_CREDENTIALS_DATA not in os.environ
):
raise DvcException(
"To use service account, set "
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/remote/test_gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ def test_drive(self, dvc, monkeypatch):
)
with pytest.raises(GDriveAuthError):
assert fs.fs

def test_service_account_using_env_var(self, dvc, monkeypatch):
monkeypatch.setenv(GDriveFileSystem.GDRIVE_CREDENTIALS_DATA, "foo")
GDriveFileSystem(
gdrive_credentials_tmp_dir=dvc.tmp_dir,
gdrive_use_service_account=True,
**self.CONFIG
)