[minor] Examples have different data folders
This commit is contained in:
parent
7cc1e778bb
commit
511f2123e6
3 changed files with 7 additions and 6 deletions
|
@ -17,6 +17,8 @@ mod shared;
|
||||||
use shared::initial_sync;
|
use shared::initial_sync;
|
||||||
use shared::{URL, USERNAME, EXAMPLE_EXISTING_CALENDAR_URL, EXAMPLE_CREATED_CALENDAR_URL};
|
use shared::{URL, USERNAME, EXAMPLE_EXISTING_CALENDAR_URL, EXAMPLE_CREATED_CALENDAR_URL};
|
||||||
|
|
||||||
|
const CACHE_FOLDER: &str = "test_cache/provider_sync";
|
||||||
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
@ -33,7 +35,7 @@ async fn main() {
|
||||||
println!(" * EXAMPLE_CREATED_CALENDAR_URL = {}", EXAMPLE_CREATED_CALENDAR_URL);
|
println!(" * EXAMPLE_CREATED_CALENDAR_URL = {}", EXAMPLE_CREATED_CALENDAR_URL);
|
||||||
pause();
|
pause();
|
||||||
|
|
||||||
let mut provider = initial_sync().await;
|
let mut provider = initial_sync(CACHE_FOLDER).await;
|
||||||
|
|
||||||
add_items_and_sync_again(&mut provider).await;
|
add_items_and_sync_again(&mut provider).await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,14 @@ pub const PASSWORD: &str = "secret_password";
|
||||||
pub const EXAMPLE_EXISTING_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_name/";
|
pub const EXAMPLE_EXISTING_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_name/";
|
||||||
pub const EXAMPLE_CREATED_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_that_we_have_created/";
|
pub const EXAMPLE_CREATED_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_that_we_have_created/";
|
||||||
|
|
||||||
const CACHE_FOLDER: &str = "test_cache/provider_sync";
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
panic!("This file is not supposed to be executed");
|
panic!("This file is not supposed to be executed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Initializes a Provider, and run an initial sync from the server
|
/// Initializes a Provider, and run an initial sync from the server
|
||||||
pub async fn initial_sync() -> CalDavProvider {
|
pub async fn initial_sync(cache_folder: &str) -> CalDavProvider {
|
||||||
let cache_path = Path::new(CACHE_FOLDER);
|
let cache_path = Path::new(cache_folder);
|
||||||
|
|
||||||
let client = Client::new(URL, USERNAME, PASSWORD).unwrap();
|
let client = Client::new(URL, USERNAME, PASSWORD).unwrap();
|
||||||
let cache = match Cache::from_folder(&cache_path) {
|
let cache = match Cache::from_folder(&cache_path) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ mod shared;
|
||||||
use shared::initial_sync;
|
use shared::initial_sync;
|
||||||
use shared::{URL, USERNAME};
|
use shared::{URL, USERNAME};
|
||||||
|
|
||||||
|
const CACHE_FOLDER: &str = "test_cache/toggle_completion";
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
@ -28,7 +29,7 @@ async fn main() {
|
||||||
println!(" * USERNAME = {}", USERNAME);
|
println!(" * USERNAME = {}", USERNAME);
|
||||||
pause();
|
pause();
|
||||||
|
|
||||||
let mut provider = initial_sync().await;
|
let mut provider = initial_sync(CACHE_FOLDER).await;
|
||||||
|
|
||||||
toggle_all_tasks_and_sync_again(&mut provider).await.unwrap();
|
toggle_all_tasks_and_sync_again(&mut provider).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue