File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -571,22 +571,27 @@ def LoadClientConfigFile(self, client_config_file=None):
571
571
pass # The service auth fields are not present, handling code can go here.
572
572
573
573
def LoadServiceConfigSettings (self ):
574
- """Loads client configuration from settings file .
574
+ """Loads client configuration from settings.
575
575
:raises: InvalidConfigError
576
576
"""
577
- for file_format in ["json" , "pkcs12" ]:
578
- config = f"client_{ file_format } _file_path"
577
+ configs = [
578
+ "client_json_file_path" ,
579
+ "client_json_dict" ,
580
+ "client_json" ,
581
+ "client_pkcs12_file_path" ,
582
+ ]
583
+
584
+ for config in configs :
579
585
value = self .settings ["service_config" ].get (config )
580
586
if value :
581
587
self .client_config [config ] = value
582
588
break
583
589
else :
584
590
raise InvalidConfigError (
585
- "Either json or pkcs12 file path required "
586
- "for service authentication"
591
+ f"One of { configs } is required for service authentication"
587
592
)
588
593
589
- if file_format == "pkcs12 " :
594
+ if config == "client_pkcs12_file_path " :
590
595
self .SERVICE_CONFIGS_LIST .append ("client_service_email" )
591
596
592
597
for config in self .SERVICE_CONFIGS_LIST :
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ def test_10_ServiceAuthFromSavedCredentialsDictionary():
157
157
def test_11_ServiceAuthFromJsonNoCredentialsSaving ():
158
158
client_json = os .environ [GDRIVE_USER_CREDENTIALS_DATA ]
159
159
settings = {
160
- "client_config_backend" : "settings " ,
160
+ "client_config_backend" : "service " ,
161
161
"service_config" : {
162
162
"client_json" : client_json ,
163
163
},
@@ -174,7 +174,7 @@ def test_11_ServiceAuthFromJsonNoCredentialsSaving():
174
174
def test_12_ServiceAuthFromJsonDictNoCredentialsSaving ():
175
175
client_json_dict = json .loads (os .environ [GDRIVE_USER_CREDENTIALS_DATA ])
176
176
settings = {
177
- "client_config_backend" : "settings " ,
177
+ "client_config_backend" : "service " ,
178
178
"service_config" : {
179
179
"client_json_dict" : client_json_dict ,
180
180
},
You can’t perform that action at this time.
0 commit comments