From 48534a8d649d9b3e07df1354d4279c807b874ff3 Mon Sep 17 00:00:00 2001 From: Mahesh Bansod Date: Sat, 23 Oct 2021 03:14:04 +0530 Subject: [PATCH] removed session file from log in test, since log out will expire the session soon anyway --- client/src/lib.rs | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index 8aca687..cd312c0 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -193,29 +193,20 @@ mod tests { #[tokio::test] async fn it_should_log_in_and_get_the_correct_peer() -> Result<(), Error> { - let sessions_file = "sessions.test"; + // let sessions_file = "sessions.test"; let creds: serde_json::Value = serde_json::from_str(&std::fs::read_to_string("test_creds.test").unwrap())?; - let mut client = new_empty_client(); - match client.load_sessions(sessions_file) { - Err(_) => { - client.new_session().await?; - - client - .authenticate_user( - 0, - creds["username"].as_str().unwrap().to_string(), - creds["password"].as_str().unwrap().to_string(), - None, - ) - .await?; - client.save_sessions(sessions_file).unwrap(); - } - _ => {} - } - println!("Authenticated. Getting the peer"); + let mut client = new_with_defaults().await?; + client + .authenticate_user( + 0, + creds["username"].as_str().unwrap().to_string(), + creds["password"].as_str().unwrap().to_string(), + None, + ) + .await?; let peer = client.get_me(0).await?;