[minor] Tests
This commit is contained in:
parent
401099ed33
commit
931d74f577
2 changed files with 22 additions and 16 deletions
|
@ -7,8 +7,6 @@ use minidom::Element;
|
|||
use url::Url;
|
||||
|
||||
use my_tasks::client::Client;
|
||||
use my_tasks::traits::BaseCalendar;
|
||||
use my_tasks::traits::DavCalendar;
|
||||
use my_tasks::traits::CalDavSource;
|
||||
|
||||
use my_tasks::settings::URL;
|
||||
|
@ -16,6 +14,9 @@ use my_tasks::settings::USERNAME;
|
|||
use my_tasks::settings::PASSWORD;
|
||||
use my_tasks::settings::EXAMPLE_TASK_URL;
|
||||
use my_tasks::settings::EXAMPLE_CALENDAR_URL;
|
||||
use my_tasks::ItemId;
|
||||
use my_tasks::traits::DavCalendar;
|
||||
|
||||
|
||||
static EXAMPLE_TASKS_BODY_LAST_MODIFIED: &str = r#"
|
||||
<C:calendar-query xmlns:D="DAV:"
|
||||
|
@ -45,19 +46,8 @@ async fn show_calendars() {
|
|||
let calendars = client.get_calendars().await.unwrap();
|
||||
|
||||
println!("Calendars:");
|
||||
for (id, calendar) in calendars.iter() {
|
||||
let cal = calendar.lock().unwrap();
|
||||
println!(" {}\t{}", cal.name(), id.as_str());
|
||||
println!(" IDs:");
|
||||
for id in cal.get_item_ids().await.unwrap() {
|
||||
println!(" * {}", id);
|
||||
}
|
||||
my_tasks::utils::print_dav_calendar_list(&calendars).await;
|
||||
|
||||
println!(" Most recent changes:");
|
||||
// for (_id, task) in cal.get_item_version_tags(None, None).await.unwrap() {
|
||||
// my_tasks::utils::print_task(task);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -104,3 +94,12 @@ async fn last_modified() {
|
|||
let el: Element = res.text().await.unwrap().parse().unwrap();
|
||||
my_tasks::utils::print_xml(&el);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// TODO: test w/ wrong creds
|
||||
// TODO: test withou connection
|
||||
//
|
||||
|
|
|
@ -24,14 +24,21 @@ async fn test_regular_sync() {
|
|||
let _ = env_logger::builder().is_test(true).try_init();
|
||||
|
||||
let mut provider = populate_test_provider().await;
|
||||
let cals_server = provider.remote().get_calendars().await.unwrap();
|
||||
println!("----Server, before sync-------");
|
||||
my_tasks::utils::print_calendar_list(&cals_server).await;
|
||||
let cals_local = provider.local().get_calendars().await.unwrap();
|
||||
println!("\n----Local, before sync-------");
|
||||
my_tasks::utils::print_calendar_list(&cals_local).await;
|
||||
|
||||
provider.sync().await.unwrap();
|
||||
|
||||
|
||||
let cals_server = provider.remote().get_calendars().await.unwrap();
|
||||
println!("----Server-------");
|
||||
println!("----Server, after sync-------");
|
||||
my_tasks::utils::print_calendar_list(&cals_server).await;
|
||||
let cals_local = provider.local().get_calendars().await.unwrap();
|
||||
println!("\n----Local-------");
|
||||
println!("\n----Local, after sync-------");
|
||||
my_tasks::utils::print_calendar_list(&cals_local).await;
|
||||
|
||||
assert!(provider.remote().has_same_contents_than(provider.local()).await.unwrap());
|
||||
|
|
Loading…
Add table
Reference in a new issue