diff options
author | Matěj Laitl <matej@laitl.cz> | 2019-11-16 22:55:54 +0100 |
---|---|---|
committer | Matěj Laitl <matej@laitl.cz> | 2019-11-17 02:03:50 +0100 |
commit | 4219c4d200b4c4aa744fdf45cf86c0f5778b97c9 (patch) | |
tree | f6667218f55edf5545d9583cab09b089bd40eeaa | |
parent | 286e5e54b1b6078e990984a83fa0e6bbb8ddbb1a (diff) |
Extend integration test with VTODO
We're going to touch it, have it under test.
-rw-r--r-- | tests/calendar.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/calendar.rs b/tests/calendar.rs index 785bec5..c57b53d 100644 --- a/tests/calendar.rs +++ b/tests/calendar.rs @@ -1,5 +1,5 @@ use chrono::prelude::*; -use icalendar::{Calendar, Class, Component, Event, EventStatus}; +use icalendar::{Calendar, Class, Component, Event, EventStatus, Todo}; const EXPECTED_CAL_CONTENT: &str = "\ BEGIN:VCALENDAR\r @@ -18,16 +18,28 @@ STATUS:TENTATIVE\r SUMMARY:summary\r UID:euid\r END:VEVENT\r +BEGIN:VTODO\r +COMPLETED:20140709T091011\r +DTSTAMP:20190307T181159\r +DUE:20140708T091011\r +PERCENT-COMPLETE:95\r +SUMMARY:A Todo\r +UID:todouid\r +END:VTODO\r END:VCALENDAR\r "; #[test] fn test_calendar_to_string() { let mut calendar = Calendar::new(); + let cest_date = FixedOffset::east(2 * 3600) + .ymd(2014, 7, 8) + .and_hms(9, 10, 11); + let utc_date = Utc.ymd(2014, 7, 9).and_hms(9, 10, 11); let event = Event::new() .status(EventStatus::Tentative) - .starts(Local.ymd(2014, 7, 8).and_hms(9, 10, 11)) - .ends(Local.ymd(2014, 7, 9).and_hms(9, 10, 11)) + .starts(cest_date) + .ends(utc_date) .priority(11) // converted to 10 .summary("summary") .description("Description") @@ -37,5 +49,14 @@ fn test_calendar_to_string() { .add_property("DTSTAMP", "20190307T181159") .done(); calendar.push(event); + let todo = Todo::new() + .percent_complete(95) + .due(&cest_date) + .completed(&utc_date) + .summary("A Todo") + .uid("todouid") + .add_property("DTSTAMP", "20190307T181159") + .done(); + calendar.push(todo); assert_eq!(calendar.to_string(), EXPECTED_CAL_CONTENT); } |