@@ -509,19 +509,14 @@ mod deploy_command {
509509 ( cloud_url, handle)
510510 }
511511
512- fn write_cloud_config ( home : & std:: path:: Path , cloud_url : & str , token : & str ) {
513- let dir = home. join ( ".rustapi" ) ;
514- fs:: create_dir_all ( & dir) . expect ( "config dir" ) ;
512+ fn write_cloud_config_file ( path : & std:: path:: Path , cloud_url : & str , token : & str ) {
515513 let config = serde_json:: json!( {
516514 "token" : token,
517515 "cloud_url" : cloud_url,
518516 "user" : { "login" : "cli-test" , "tier" : "hobby" }
519517 } ) ;
520- fs:: write (
521- dir. join ( "config.json" ) ,
522- serde_json:: to_string_pretty ( & config) . expect ( "json" ) ,
523- )
524- . expect ( "write config" ) ;
518+ fs:: write ( path, serde_json:: to_string_pretty ( & config) . expect ( "json" ) )
519+ . expect ( "write config" ) ;
525520 }
526521
527522 #[ test]
@@ -546,12 +541,12 @@ mod deploy_command {
546541 fn test_deploy_status_fetches_live_response_from_cloud ( ) {
547542 let deploy_id = "cli-mock-deploy-1" ;
548543 let ( cloud_url, server) = spawn_mock_deploy_status_server ( deploy_id) ;
549- let home = tempdir ( ) . expect ( "cli home" ) ;
550- write_cloud_config ( home. path ( ) , & cloud_url, "mock-jwt-token" ) ;
544+ let dir = tempdir ( ) . expect ( "config dir" ) ;
545+ let config_path = dir. path ( ) . join ( "cloud-config.json" ) ;
546+ write_cloud_config_file ( & config_path, & cloud_url, "mock-jwt-token" ) ;
551547
552548 cargo_rustapi ( )
553- . env ( "USERPROFILE" , home. path ( ) )
554- . env ( "HOME" , home. path ( ) )
549+ . env ( "RUSTAPI_CONFIG_PATH" , & config_path)
555550 . args ( [ "deploy" , "status" , deploy_id] )
556551 . assert ( )
557552 . success ( )
0 commit comments