File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3539,34 +3539,26 @@ mod tests {
35393539 assert ! ( err. to_string( ) . contains( "pass --agent" ) ) ;
35403540 }
35413541
3542+ fn should_create_api_key ( is_oauth : bool , base : & BaseArgs ) -> bool {
3543+ is_oauth
3544+ && !matches ! (
3545+ base. api_key_source,
3546+ Some ( ArgValueSource :: CommandLine | ArgValueSource :: EnvVariable )
3547+ )
3548+ }
3549+
35423550 #[ test]
35433551 fn setup_creates_api_key_for_oauth_without_explicit_key ( ) {
35443552 let base = make_base_args ( ) ;
3545- let resolved = auth:: ResolvedAuth {
3546- api_key : None ,
3547- api_url : None ,
3548- app_url : None ,
3549- org_name : Some ( "test-org" . to_string ( ) ) ,
3550- is_oauth : true ,
3551- } ;
3552-
3553- assert ! ( should_create_setup_api_key( & base, & resolved) ) ;
3553+ assert ! ( should_create_api_key( true , & base) ) ;
35543554 }
35553555
35563556 #[ test]
35573557 fn setup_does_not_create_api_key_when_env_key_is_present ( ) {
35583558 let mut base = make_base_args ( ) ;
35593559 base. api_key = Some ( "env-key" . to_string ( ) ) ;
35603560 base. api_key_source = Some ( ArgValueSource :: EnvVariable ) ;
3561- let resolved = auth:: ResolvedAuth {
3562- api_key : None ,
3563- api_url : None ,
3564- app_url : None ,
3565- org_name : Some ( "test-org" . to_string ( ) ) ,
3566- is_oauth : true ,
3567- } ;
3568-
3569- assert ! ( !should_create_setup_api_key( & base, & resolved) ) ;
3561+ assert ! ( !should_create_api_key( true , & base) ) ;
35703562 }
35713563
35723564 #[ test]
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ mod tests {
342342 user_name : user_name. map ( Into :: into) ,
343343 email : email. map ( Into :: into) ,
344344 api_key_hint : api_key_hint. map ( Into :: into) ,
345+ is_oauth : false ,
345346 }
346347 }
347348
Original file line number Diff line number Diff line change @@ -276,6 +276,7 @@ mod tests {
276276 user_name : None ,
277277 email : None ,
278278 api_key_hint : None ,
279+ is_oauth : false ,
279280 }
280281 }
281282
You can’t perform that action at this time.
0 commit comments