aboutsummaryrefslogtreecommitdiff
path: root/aerogramme
diff options
context:
space:
mode:
Diffstat (limited to 'aerogramme')
-rw-r--r--aerogramme/tests/behavior.rs51
-rw-r--r--aerogramme/tests/common/constants.rs17
2 files changed, 45 insertions, 23 deletions
diff --git a/aerogramme/tests/behavior.rs b/aerogramme/tests/behavior.rs
index 0e6dab6..d6c73e3 100644
--- a/aerogramme/tests/behavior.rs
+++ b/aerogramme/tests/behavior.rs
@@ -590,6 +590,13 @@ fn rfc4791_webdav_caldav() {
.send()?;
let _obj5_etag = resp.headers().get("etag").expect("etag must be set");
assert_eq!(resp.status(), 201);
+ let resp = http
+ .put("http://localhost:8087/alice/calendar/Personal/rfc6.ics")
+ .header("If-None-Match", "*")
+ .body(ICAL_RFC6)
+ .send()?;
+ let _obj6_etag = resp.headers().get("etag").expect("etag must be set");
+ assert_eq!(resp.status(), 201);
// A generic function to check a <calendar-data/> query result
let check_cal =
@@ -611,25 +618,17 @@ fn rfc4791_webdav_caldav() {
.iter()
.find(|p| p.status.0.as_u16() == 200)
.expect("some propstats must be 200");
- let etag = obj_success
- .prop
- .0
- .iter()
- .find_map(|p| match p {
- dav::AnyProperty::Value(dav::Property::GetEtag(x)) => Some(x.as_str()),
- _ => None,
- });
+ let etag = obj_success.prop.0.iter().find_map(|p| match p {
+ dav::AnyProperty::Value(dav::Property::GetEtag(x)) => Some(x.as_str()),
+ _ => None,
+ });
assert_eq!(etag, ref_etag);
- let calendar_data = obj_success
- .prop
- .0
- .iter()
- .find_map(|p| match p {
- dav::AnyProperty::Value(dav::Property::Extension(
- realization::Property::Cal(cal::Property::CalendarData(x)),
- )) => Some(x.payload.as_bytes()),
- _ => None,
- });
+ let calendar_data = obj_success.prop.0.iter().find_map(|p| match p {
+ dav::AnyProperty::Value(dav::Property::Extension(
+ realization::Property::Cal(cal::Property::CalendarData(x)),
+ )) => Some(x.payload.as_bytes()),
+ _ => None,
+ });
assert_eq!(calendar_data, ref_ical);
};
@@ -753,7 +752,14 @@ fn rfc4791_webdav_caldav() {
assert_eq!(resp.status(), 207);
let multistatus = dav_deserialize::<dav::Multistatus<All>>(&resp.text()?);
assert_eq!(multistatus.responses.len(), 1);
- check_cal(&multistatus, ("/alice/calendar/Personal/rfc2.ics", Some(obj2_etag.to_str().expect("etag header convertible to str")), None));
+ check_cal(
+ &multistatus,
+ (
+ "/alice/calendar/Personal/rfc2.ics",
+ Some(obj2_etag.to_str().expect("etag header convertible to str")),
+ None,
+ ),
+ );
// 7.8.5. Example: Retrieval of To-Dos by Alarm Time Range
let cal_query = r#"<?xml version="1.0" encoding="utf-8" ?>
@@ -766,7 +772,7 @@ fn rfc4791_webdav_caldav() {
<C:comp-filter name="VCALENDAR">
<C:comp-filter name="VTODO">
<C:comp-filter name="VALARM">
- <C:time-range start="20060106T100000Z" end="20060107T100000Z"/>
+ <C:time-range start="20060201T000000Z" end="20060301T000000Z"/>
</C:comp-filter>
</C:comp-filter>
</C:comp-filter>
@@ -781,18 +787,17 @@ fn rfc4791_webdav_caldav() {
.send()?;
assert_eq!(resp.status(), 207);
let multistatus = dav_deserialize::<dav::Multistatus<All>>(&resp.text()?);
- //assert_eq!(multistatus.responses.len(), 1);
+ assert_eq!(multistatus.responses.len(), 1);
// 7.8.6. Example: Retrieval of Event by UID
// @TODO
// 7.8.7. Example: Retrieval of Events by PARTSTAT
// @TODO
-
+
// 7.8.9. Example: Retrieval of All Pending To-Dos
// @TODO
-
// --- REPORT calendar-multiget ---
let cal_query = r#"<?xml version="1.0" encoding="utf-8" ?>
<C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
diff --git a/aerogramme/tests/common/constants.rs b/aerogramme/tests/common/constants.rs
index 8874876..91ee159 100644
--- a/aerogramme/tests/common/constants.rs
+++ b/aerogramme/tests/common/constants.rs
@@ -158,3 +158,20 @@ UID:E10BA47467C5C69BB74E8725@example.com
END:VTODO
END:VCALENDAR
"#;
+
+pub static ICAL_RFC6: &[u8] = br#"BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//Example Corp.//CalDAV Client//EN
+BEGIN:VTODO
+DTSTART:20060205T235335Z
+DUE;VALUE=DATE:20060104
+STATUS:NEEDS-ACTION
+SUMMARY:Task #1
+UID:DDDEEB7915FA61233B861457@example.com
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER;RELATED=START:-PT10M
+END:VALARM
+END:VTODO
+END:VCALENDAR
+"#;