_caldav__Thunderbird_add_event (private)

 _caldav__Thunderbird_add_event

Defined in packages/caldav/tcl/test/caldav-test-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_test::visualize_control_chars aa_test::visualize_control_chars aa_true aa_true (public) _caldav__Thunderbird_add_event _caldav__Thunderbird_add_event _caldav__Thunderbird_add_event->aa_equals _caldav__Thunderbird_add_event->aa_log _caldav__Thunderbird_add_event->aa_log_result _caldav__Thunderbird_add_event->aa_test::visualize_control_chars _caldav__Thunderbird_add_event->aa_true

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 {
        #
        # We want a valid calendar entry without an entry in cal_uids.
        #
        set uid "bfdf5503-c795-5946-93fc-cb445f189817"

        #
        # Make sure, uid of the item to be inserted newly does not
        # exist.
        #
        set cal_info [::caldav::calendars get_calendar_and_cal_item_from_uid $uid]
        if {[llength $cal_info] > 0} {
            #
            # Someone has already inserted such an item. Remove it!
            #
            lassign [lindex $cal_info 0] calendar_id cal_item_id
            aa_log "deleting cal_item $cal_item_id with uid $uid"
            calendar::item::delete -cal_item_id $cal_item_id
        }

        #
        # PUT REQUEST
        #
        set icalText ""
        append icalText  {BEGIN:VCALENDAR} \r\n {PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN} \r\n {VERSION:2.0} \r\n {BEGIN:VTIMEZONE} \r\n {TZID:Europe/Berlin} \r\n {BEGIN:DAYLIGHT} \r\n {TZOFFSETFROM:+0100} \r\n {TZOFFSETTO:+0200} \r\n {TZNAME:CEST} \r\n {DTSTART:19700329T020000} \r\n {RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3} \r\n {END:DAYLIGHT} \r\n {BEGIN:STANDARD} \r\n {TZOFFSETFROM:+0200} \r\n {TZOFFSETTO:+0100} \r\n {TZNAME:CET} \r\n {DTSTART:19701025T030000} \r\n {RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10} \r\n {END:STANDARD} \r\n {END:VTIMEZONE} \r\n {BEGIN:VEVENT} \r\n {CREATED:20180402T094320Z} \r\n {LAST-MODIFIED:20180402T094426Z} \r\n {DTSTAMP:20180402T094426Z} \r\n {UID:bfdf5503-c795-5946-93fc-cb445f189817} \r\n {SUMMARY:thunderbild event} \r\n {DTSTART;TZID=Europe/Berlin:20180402T150000} \r\n {DTEND;TZID=Europe/Berlin:20180402T160000} \r\n {TRANSP:OPAQUE} \r\n {DESCRIPTION:from 3 to 4} \r\n {END:VEVENT} \r\n {END:VCALENDAR} \r\n 
        # item is from three to four pm
        set created [::caldav::test::ical_extract $icalText CREATED]
        set DTSTART [lindex [::caldav::test::ical_extract $icalText DTSTART] end]
        set DTEND   [lindex [::caldav::test::ical_extract $icalText DTEND]]
        set isummary [::caldav::test::ical_extract $icalText SUMMARY]

        aa_log "created $created DTSTART $DTSTART DTEND $DTEND"

    set d [::acs::test::http  -user_info $user_info  -method PUT  -headers {Content-Type text/calendar}  -body $icalText  /caldav/calendar/$uid.ics]

        aa_equals "Status code valid" [dict get $d status] 201

    set d [::acs::test::http  -user_info $user_info  -method GET  /caldav/calendar/$uid.ics]

        set rIcalText [dict get $d body]
    aa_log "Result body:<pre>\n[::aa_test::visualize_control_chars $rIcalText]</pre>"

        set rsummary     [::caldav::test::ical_extract $rIcalText SUMMARY]
        set rdescription [::caldav::test::ical_extract $rIcalText DESCRIPTION]

        aa_equals "Retrieved Ical valid" [::caldav::test::ical_valid $rIcalText""

        set rlocation    [::caldav::test::ical_extract $rIcalText LOCATION]
        set rsummary     [::caldav::test::ical_extract $rIcalText SUMMARY]

        aa_equals "location empty"        $rlocation ""
        aa_true   "last_modified updated" {$isummary eq $rsummary}

        #
    # REPORT request (calendar-multiget with single href, getting etag and calendar-data)
        #
        incr queryNr

    set d [::acs::test::http -prefix "$queryNr: "  -user_info $user_info  -method REPORT  -headers {Content-Type text/xml}  -body {<?xml version="1.0" encoding="UTF-8"?>
                       <C:calendar-multiget xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
                       <D:prop>
                       <D:getetag/>
                       <C:calendar-data/>
                       </D:prop>
                       <D:href>/caldav/calendar/bfdf5503-c795-5946-93fc-cb445f189817.ics</D:href>
                       </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>"

        ::caldav::test::foreach_response response $xml {
            ::acs::test::xpath::non_empty $response {
                d:href
                d:propstat/d:prop/d:getetag
            }
            set href [::acs::test::xpath::get_text $response d:href]
            aa_true "href for calitem ends with .ics" [string match *ics $href]

            set icalText [::acs::test::xpath::get_text $response d:propstat/d:prop/c:calendar-data]

            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""
        }
    } 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" "Thunderbird_add_event (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: