This commit is contained in:
daladim 2021-03-19 00:01:32 +01:00
parent 060f33b4bd
commit 35674a80c7

View file

@ -8,6 +8,7 @@ use url::Url;
use my_tasks::client::Client; use my_tasks::client::Client;
use my_tasks::traits::PartialCalendar; use my_tasks::traits::PartialCalendar;
use my_tasks::traits::CalDavSource;
use my_tasks::settings::URL; use my_tasks::settings::URL;
use my_tasks::settings::USERNAME; use my_tasks::settings::USERNAME;
@ -39,19 +40,17 @@ static EXAMPLE_TASKS_BODY_LAST_MODIFIED: &str = r#"
async fn test_client() { async fn test_client() {
let _ = env_logger::builder().is_test(true).try_init(); let _ = env_logger::builder().is_test(true).try_init();
let mut client = Client::new(URL, USERNAME, PASSWORD).unwrap(); let client = Client::new(URL, USERNAME, PASSWORD).unwrap();
let calendars = client.get_calendars().await.unwrap(); let calendars = client.get_calendars().await.unwrap();
let mut last_cal = None; let mut last_cal = None;
println!("Calendars:"); println!("Calendars:");
let _ = calendars.iter() let _ = calendars.iter()
.map(|(id, cal)| { .map(|(id, cal)| {
println!(" {}\t{}", cal.name(), id.as_str()); println!(" {}\t{}", cal.lock().unwrap().name(), id.as_str());
last_cal = Some(id); last_cal = Some(id);
}) })
.collect::<()>(); .collect::<()>();
let _ = client.get_tasks(&last_cal.unwrap()).await;
} }
#[tokio::test] #[tokio::test]