Make test_malformed_url work with no BasicAuth

This commit is contained in:
Nick Zana 2021-03-13 21:55:05 -05:00
parent c75029f59e
commit 23330680d6

View File

@ -380,11 +380,12 @@ mod tests {
dotenv().ok(); dotenv().ok();
env_logger::init(); env_logger::init();
let url = env::var("TURL")?; let url = env::var("TURL")?;
let basic_auth = BasicAuth { let client;
user: env::var("TUSER")?, if let (Ok(user), Ok(password)) = (env::var("TUSER"), env::var("TPWD")) {
password: env::var("TPWD")?, client = TransClient::with_auth(&url, BasicAuth {user, password});
}; } else {
let client = TransClient::with_auth(&url, basic_auth); client = TransClient::new(&url);
}
info!("Client is ready!"); info!("Client is ready!");
let add: TorrentAddArgs = TorrentAddArgs { let add: TorrentAddArgs = TorrentAddArgs {
filename: Some( filename: Some(