Merge "Prepare Google Backup driver for latest libraries"
This commit is contained in:
commit
3ec497ccd9
|
@ -166,7 +166,8 @@ class GoogleBackupDriver(chunkeddriver.ChunkedBackupDriver):
|
|||
creds = service_account.Credentials.from_service_account_file(
|
||||
backup_credential)
|
||||
OAUTH_EXCEPTIONS = (gexceptions.RefreshError,
|
||||
gexceptions.DefaultCredentialsError)
|
||||
gexceptions.DefaultCredentialsError,
|
||||
client.Error)
|
||||
|
||||
# Can't use google-auth, use deprecated oauth2client
|
||||
else:
|
||||
|
|
|
@ -76,6 +76,11 @@ def gcs_client(func):
|
|||
fake_google_client.FakeGoogleMediaIoBaseDownload)
|
||||
@mock.patch.object(hashlib, 'md5', FakeMD5)
|
||||
def func_wrapper(self, *args, **kwargs):
|
||||
if google_dr.service_account:
|
||||
with mock.patch.object(google_dr.service_account.Credentials,
|
||||
'from_service_account_file',
|
||||
fake_google_client.FakeGoogleCredentials):
|
||||
return func(self, *args, **kwargs)
|
||||
return func(self, *args, **kwargs)
|
||||
|
||||
return func_wrapper
|
||||
|
@ -93,6 +98,11 @@ def gcs_client2(func):
|
|||
FakeObjectName._fake_generate_object_name_prefix)
|
||||
@mock.patch.object(hashlib, 'md5', FakeMD5)
|
||||
def func_wrapper(self, *args, **kwargs):
|
||||
if google_dr.service_account:
|
||||
with mock.patch.object(google_dr.service_account.Credentials,
|
||||
'from_service_account_file',
|
||||
fake_google_client.FakeGoogleCredentials):
|
||||
return func(self, *args, **kwargs)
|
||||
return func(self, *args, **kwargs)
|
||||
|
||||
return func_wrapper
|
||||
|
|
Loading…
Reference in New Issue