paul@734 | 1 | #!/bin/sh |
paul@734 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@734 | 4 | |
paul@734 | 5 | USER="mailto:vincent.vole@example.com" |
paul@734 | 6 | SENDER="mailto:paul.boddie@example.com" |
paul@734 | 7 | |
paul@734 | 8 | mkdir -p "$PREFS/$USER" |
paul@734 | 9 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@734 | 10 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@734 | 11 | |
paul@734 | 12 | mkdir -p "$PREFS/$SENDER" |
paul@734 | 13 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@734 | 14 | echo 'always' > "$PREFS/$SENDER/event_refreshing" |
paul@734 | 15 | |
paul@1438 | 16 | # Make a new event. |
paul@734 | 17 | |
paul@1438 | 18 | cat > "event_cmd.tmp" <<EOF |
paul@1438 | 19 | new |
paul@1438 | 20 | period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo |
paul@1438 | 21 | rrule |
paul@1438 | 22 | freq monthly 1 |
paul@1438 | 23 | selection weekday FR 2 end |
paul@1438 | 24 | count 3 |
paul@1438 | 25 | end |
paul@1438 | 26 | attendance accept |
paul@1438 | 27 | attendee mailto:vincent.vole@example.com |
paul@1438 | 28 | summary Recurring event |
paul@1438 | 29 | finish |
paul@1438 | 30 | update event.tmp |
paul@1438 | 31 | publish event_self.tmp |
paul@1438 | 32 | UID event_uid.tmp |
paul@1438 | 33 | EOF |
paul@734 | 34 | |
paul@1438 | 35 | text_client "$SENDER" "event_cmd.tmp" |
paul@734 | 36 | |
paul@1438 | 37 | # Obtain the event UID. |
paul@1088 | 38 | |
paul@1438 | 39 | read UID1 < "event_uid.tmp" |
paul@734 | 40 | |
paul@1438 | 41 | # Register the event at the sender. |
paul@734 | 42 | |
paul@1438 | 43 | outgoing_script "event_self.tmp" |
paul@734 | 44 | |
paul@1438 | 45 | # Expect free/busy periods for the sender. |
paul@1088 | 46 | |
paul@1438 | 47 | list_script "out1f.tmp" "$SENDER" "freebusy" |
paul@1438 | 48 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp" |
paul@734 | 49 | |
paul@734 | 50 | # Present the request to the recipient. |
paul@734 | 51 | |
paul@1438 | 52 | person_script "event.tmp" "out2.tmp" |
paul@1438 | 53 | |
paul@1438 | 54 | # Expect no reply because the recipient must handle the request. |
paul@1438 | 55 | |
paul@1438 | 56 | is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" |
paul@1438 | 57 | |
paul@1438 | 58 | # Expect no free/busy periods for the recipient. |
paul@734 | 59 | |
paul@1438 | 60 | list_script "out2f.tmp" "$USER" "freebusy" |
paul@1438 | 61 | test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp" |
paul@1438 | 62 | |
paul@1438 | 63 | # Expect free/busy periods for the sender at the recipient. |
paul@1438 | 64 | |
paul@1438 | 65 | list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1438 | 66 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp" |
paul@734 | 67 | |
paul@1438 | 68 | # Accept the invitation. |
paul@1438 | 69 | |
paul@1438 | 70 | cat > "event_accept_cmd.tmp" <<EOF |
paul@1438 | 71 | attendance accept |
paul@1438 | 72 | finish |
paul@1438 | 73 | update event_accept.tmp |
paul@1438 | 74 | EOF |
paul@1088 | 75 | |
paul@1438 | 76 | text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" |
paul@1438 | 77 | |
paul@1438 | 78 | # Register the acceptance at the recipient. |
paul@1438 | 79 | |
paul@1438 | 80 | outgoing_script "event_accept.tmp" |
paul@1438 | 81 | |
paul@1438 | 82 | # Test the nature of the acceptance message. |
paul@734 | 83 | |
paul@1438 | 84 | showmail "event_accept.tmp" | is_present 'METHOD:REPLY' \ |
paul@1438 | 85 | && success || failed "event_accept.tmp" |
paul@1438 | 86 | |
paul@1438 | 87 | # Expect free/busy periods at the recipient. |
paul@1438 | 88 | |
paul@1438 | 89 | list_script "out3f.tmp" "$USER" "freebusy" |
paul@1438 | 90 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out3f.tmp" |
paul@1088 | 91 | |
paul@1438 | 92 | # Present the result to the sender. |
paul@1438 | 93 | |
paul@1438 | 94 | person_script "event_accept.tmp" "out4.tmp" |
paul@1438 | 95 | |
paul@1438 | 96 | # Expect free/busy periods at the sender for the recipient. |
paul@1438 | 97 | |
paul@1438 | 98 | list_script "out4fo.tmp" "$SENDER" "freebusy_other" "$USER" |
paul@1438 | 99 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out4fo.tmp" |
paul@734 | 100 | |
paul@1438 | 101 | # Attempt to add an occurrence to the event. |
paul@1438 | 102 | |
paul@1438 | 103 | cat > "event_cmd2.tmp" <<EOF |
paul@1438 | 104 | period new 20150109 10 00 00 Europe/Oslo 20150109 11 00 00 Europe/Oslo |
paul@1438 | 105 | finish |
paul@1438 | 106 | update event_add.tmp |
paul@1438 | 107 | EOF |
paul@1438 | 108 | |
paul@1438 | 109 | text_client_specific "$SENDER" "event_cmd2.tmp" "$UID1" |
paul@734 | 110 | |
paul@1438 | 111 | # Register the new occurrence at the sender. |
paul@1438 | 112 | |
paul@1438 | 113 | outgoing_script "event_add.tmp" |
paul@734 | 114 | |
paul@1438 | 115 | # Expect free/busy periods for the event at the sender. |
paul@1438 | 116 | |
paul@1438 | 117 | list_script "out4f.tmp" "$SENDER" "freebusy" |
paul@1438 | 118 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out4f.tmp" |
paul@1438 | 119 | test_freebusy '20150109T090000Z' '20150109T100000Z' "out4f.tmp" |
paul@734 | 120 | |
paul@734 | 121 | # Present the request to the recipient. |
paul@734 | 122 | |
paul@1438 | 123 | person_script "event_add.tmp" "out5.tmp" |
paul@1438 | 124 | |
paul@1438 | 125 | # Expect a response demanding a refreshed event. |
paul@1438 | 126 | |
paul@1438 | 127 | is_present 'METHOD:REFRESH' "out5.tmp" && success || failed "out5.tmp" |
paul@1438 | 128 | |
paul@1438 | 129 | # Expect no new free/busy period for the event at the recipient. |
paul@734 | 130 | |
paul@1438 | 131 | list_script "out5f.tmp" "$USER" "freebusy" |
paul@1438 | 132 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out5f.tmp" |
paul@1438 | 133 | test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5f.tmp" |
paul@734 | 134 | |
paul@1438 | 135 | list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1438 | 136 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out5fo.tmp" |
paul@1438 | 137 | test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out5fo.tmp" |
paul@1438 | 138 | |
paul@1438 | 139 | # Present the refresh message to the organiser. |
paul@1438 | 140 | |
paul@1438 | 141 | person_script "out5.tmp" "out6.tmp" "out6r.tmp" |
paul@1438 | 142 | |
paul@1438 | 143 | # Expect a new event request from the organiser. |
paul@1088 | 144 | |
paul@1438 | 145 | is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp" |
paul@1438 | 146 | |
paul@1438 | 147 | # Present the request to the recipient. |
paul@1438 | 148 | |
paul@1438 | 149 | person_script "out6r.tmp" "out7.tmp" |
paul@1438 | 150 | |
paul@1438 | 151 | # Expect no reply because the recipient must handle the request. |
paul@1438 | 152 | |
paul@1438 | 153 | is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" |
paul@734 | 154 | |
paul@1438 | 155 | # Expect no new free/busy period for the event at the recipient. |
paul@1438 | 156 | |
paul@1438 | 157 | list_script "out7f.tmp" "$USER" "freebusy" |
paul@1438 | 158 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out7f.tmp" |
paul@1438 | 159 | test_freebusy_missing '20150109T090000Z' '20150109T100000Z' "out7f.tmp" |
paul@1088 | 160 | |
paul@1438 | 161 | # Expect the new free/busy period for the sender at the recipient. |
paul@1438 | 162 | |
paul@1438 | 163 | list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1438 | 164 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out7fo.tmp" |
paul@1438 | 165 | test_freebusy '20150109T090000Z' '20150109T100000Z' "out7fo.tmp" |
paul@734 | 166 | |
paul@734 | 167 | # Test acceptance and registration in the outgoing handler. |
paul@734 | 168 | |
paul@1438 | 169 | text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" |
paul@1438 | 170 | outgoing_script "event_accept.tmp" |
paul@1438 | 171 | |
paul@1438 | 172 | # Accept the invitation. |
paul@734 | 173 | |
paul@1438 | 174 | cat > "event_accept_cmd2.tmp" <<EOF |
paul@1438 | 175 | attendance accept |
paul@1438 | 176 | finish |
paul@1438 | 177 | update event_accept2.tmp |
paul@1438 | 178 | EOF |
paul@734 | 179 | |
paul@1438 | 180 | text_client_specific "$USER" "event_accept_cmd2.tmp" "$UID1" '20150109T090000Z' |
paul@734 | 181 | |
paul@1438 | 182 | # Register the acceptance at the recipient. |
paul@1438 | 183 | |
paul@1438 | 184 | outgoing_script "event_accept2.tmp" |
paul@1438 | 185 | |
paul@1438 | 186 | # Test the nature of the acceptance message. |
paul@734 | 187 | |
paul@1438 | 188 | showmail "event_accept2.tmp" | is_present 'METHOD:REPLY' \ |
paul@1438 | 189 | && success || failed "event_accept2.tmp" |
paul@1088 | 190 | |
paul@1438 | 191 | # Expect the new free/busy period at the recipient. |
paul@1438 | 192 | |
paul@1438 | 193 | list_script "out9f.tmp" "$USER" "freebusy" |
paul@1438 | 194 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f.tmp" |
paul@1438 | 195 | test_freebusy '20150109T090000Z' '20150109T100000Z' "out9f.tmp" |