@@ -316,11 +316,27 @@ def test_load_user_metadata_bad(inputs, expected_error_msg):
316
316
317
317
@pytest .mark .parametrize (
318
318
"inputs, expected" ,
319
- [
320
- ([None , None ], ["home_username" , "[email protected] " ]),
321
- (["cli_username" , None ], ["cli_username" , "[email protected] " ]),
322
- ([None , "[email protected] " ], ["home_username" , "[email protected] " ]),
323
- (["cli_username" , "[email protected] " ], ["cli_username" , "[email protected] " ]),
319
+ [ # Test that when cli inputs are present, they override home config, otherwise we take home config
320
+ (
321
+ {"username" : None , "email" : None , "orcid" : None },
322
+ {"username" : "home_username" , "email" : "[email protected] " , "orcid" : "home_orcid" },
323
+ ),
324
+ (
325
+ {"username" : "cli_username" , "email" : None , "orcid" : None },
326
+ {"username" : "cli_username" , "email" : "[email protected] " , "orcid" : "home_orcid" },
327
+ ),
328
+ (
329
+ {"username" : None , "email" : "[email protected] " , "orcid" : None },
330
+ {"username" : "home_username" , "email" : "[email protected] " , "orcid" : "home_orcid" },
331
+ ),
332
+ (
333
+ {"username" : None , "email" : None , "orcid" : "cli_orcid" },
334
+ {"username" : "home_username" , "email" : "[email protected] " , "orcid" : "cli_orcid" },
335
+ ),
336
+ (
337
+ {"username" : "cli_username" , "email" : "[email protected] " , "orcid" : "cli_orcid" },
338
+ {"username" : "cli_username" , "email" : "[email protected] " , "orcid" : "cli_orcid" },
339
+ ),
324
340
],
325
341
)
326
342
def test_load_user_info (monkeypatch , inputs , expected , user_filesystem ):
@@ -329,12 +345,21 @@ def test_load_user_info(monkeypatch, inputs, expected, user_filesystem):
329
345
monkeypatch .setattr ("pathlib.Path.home" , lambda _ : home_dir )
330
346
os .chdir (cwd )
331
347
332
- expected_username , expected_email = expected
333
- cli_inputs = ["2.5" , "data.xy" , "--username" , inputs [0 ], "--email" , inputs [1 ]]
348
+ cli_inputs = [
349
+ "2.5" ,
350
+ "data.xy" ,
351
+ "--username" ,
352
+ inputs ["username" ],
353
+ "--email" ,
354
+ inputs ["email" ],
355
+ "--orcid" ,
356
+ inputs ["orcid" ],
357
+ ]
334
358
actual_args = get_args (cli_inputs )
335
359
actual_args = load_user_info (actual_args )
336
- assert actual_args .username == expected_username
337
- assert actual_args .email == expected_email
360
+ assert actual_args .username == expected ["username" ]
361
+ assert actual_args .email == expected ["email" ]
362
+ assert actual_args .orcid == expected ["orcid" ]
338
363
339
364
340
365
def test_load_package_info (mocker ):
0 commit comments