_caldav__REPORT_ios (private)
_caldav__REPORT_ios
Defined in packages/caldav/tcl/test/caldav-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ set info [::caldav::test::basic_setup] set user_info [dict get $info user_info] try { # Test REPORT functionality of the CalDAV server # iOS/11.2.6 (15D100) dataaccessd/1.0 # set d [::acs::test::http -user_info $user_info -method REPORT -headers {Content-Type text/xml} -body {<?xml version="1.0" encoding="UTF-8"?> <B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav"> <A:prop xmlns:A="DAV:"> <A:getetag/> <A:getcontenttype/> </A:prop> <B:filter> <B:comp-filter name="VCALENDAR"> <B:comp-filter name="VEVENT"> <B:time-range start="20180221T000000Z"/> </B:comp-filter> </B:comp-filter> </B:filter> </B:calendar-query> } /caldav/calendar/] aa_equals "Status code valid" [dict get $d status] 207 set xml [dict get $d body] aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $xml]</pre>" ::caldav::test::foreach_response response $xml { ::acs::test::xpath::non_empty $response { d:href d:propstat/d:prop/d:getetag d:propstat/d:prop/d:getcontenttype } set href [::acs::test::xpath::get_text $response d:href] aa_true "href for calitem ends with .ics" [string match *ics $href] } # # Test with calendar-query with calendar-data # set d [::acs::test::http -user_info $user_info -method REPORT -headers {Content-Type text/xml} -body {<?xml version="1.0" encoding="UTF-8"?> <B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav"> <A:prop xmlns:A="DAV:"> <A:getetag/> <B:calendar-data/> </A:prop> <B:filter> <B:comp-filter name="VCALENDAR"> <B:comp-filter name="VEVENT"> <B:time-range start="20180221T000000Z"/> </B:comp-filter> </B:comp-filter> </B:filter> </B:calendar-query> } /caldav/calendar/] aa_equals "Status code valid" [dict get $d status] 207 set xml [dict get $d body] aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $xml]</pre>" ::caldav::test::foreach_response response $xml { ::acs::test::xpath::non_empty $response { d:href d:propstat/d:prop/d:getetag d:propstat/d:prop/c:calendar-data } set href [::acs::test::xpath::get_text $response d:href] set icalText [::acs::test::xpath::get_text $response d:propstat/d:prop/c:calendar-data] #aa_log CHECK=[::aa_test::visualize_control_chars $icalText] aa_true "href for calitem ends with .ics" [string match *ics $href] aa_equals "Ical of $href valid" [::caldav::test::ical_valid -require_crlf=0 $icalText] "" } ############################################################################# # test calendar-multiget in two steps # 1) run PROPFIND to return valid hrefs # 2) run REPORT to obtain calendar-multiget data ############################################################################# # # Run PROFIND with Depth 1 to obtain hrefs # set d [::acs::test::http -user_info $user_info -method PROPFIND -headers {Content-Type text/xml Depth 1} -body [::caldav::test::propfind_body "<D:getetag/>"] /caldav/calendar] aa_equals "Status code valid" [dict get $d status] 207 set xml [dict get $d body] aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $xml]</pre>" set nr_hrefs 0 set href_xml "" ::caldav::test::foreach_response response $xml { set href [::acs::test::xpath::get_text $response d:href] if {![string match *.ics $href]} continue append href_xml <d:href> $href </d:href> \n incr nr_hrefs } aa_log "run calendar-multiget REPORT on the following hrefs:\n$href_xml" # # now run REPORT over the returned hrefs # set d [::acs::test::http -user_info $user_info -method REPORT -headers {Content-Type text/xml} -body [subst {<?xml version="1.0" encoding="UTF-8"?> <c:calendar-multiget xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:"> <d:prop><d:getetag/><c:calendar-data/></d:prop> $href_xml </c:calendar-multiget> }] /caldav/calendar/] aa_equals "Status code valid" [dict get $d status] 207 set xml [dict get $d body] #aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $xml]</pre>" set nr_responses 0 ::caldav::test::foreach_response response $xml { set icalText [::acs::test::xpath::get_text $response d:propstat/d:prop/c:calendar-data] set href [::acs::test::xpath::get_text $response d:href] #aa_log CHECK=[::aa_test::visualize_control_chars $icalText] aa_equals "Ical of $href valid" [::caldav::test::ical_valid -require_crlf=0 $icalText] "" incr nr_responses } aa_equals "there is a response for every href" $nr_responses $nr_hrefs ############################################################################# # test sync-collection REPORT ############################################################################# # # Example from https://tools.ietf.org/html/rfc6578 # set d [::acs::test::http -user_info $user_info -method REPORT -headers {Content-Type text/xml} -body {<?xml version="1.0" encoding="utf-8" ?> <D:sync-collection xmlns:D="DAV:"> <D:sync-token/> <D:sync-level>1</D:sync-level> <D:prop xmlns:R="urn:ns.example.com:boxschema"> <D:getetag/> <R:bigbox/> </D:prop> </D:sync-collection>} /caldav/calendar] aa_equals "Status code valid" [dict get $d status] 207 set xml [dict get $d body] aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $xml]</pre>" set nr_responses 0 ::caldav::test::foreach_response response $xml { set href [::acs::test::xpath::get_text $response d:href] ::acs::test::xpath::non_empty $response { d:propstat/d:prop/d:getetag } incr nr_responses } dom parse -- $xml doc $doc documentElement root ::acs::test::xpath::non_empty $root { d:sync-token } set sync_token [::acs::test::xpath::get_text $root d:sync-token] aa_true "there are multiple etags" {$nr_responses > 1} } on error {errorMsg} { aa_true "Error msg: $errorMsg" 0 } finally { #calendar::delete -calendar_id $temp_calendar_id } }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "REPORT_ios (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle