paul@594 | 1 | #!/bin/sh |
paul@594 | 2 | |
paul@1024 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@594 | 4 | |
paul@594 | 5 | USER="mailto:vincent.vole@example.com" |
paul@594 | 6 | SENDER="mailto:paul.boddie@example.com" |
paul@594 | 7 | |
paul@640 | 8 | mkdir -p "$PREFS/$USER" |
paul@640 | 9 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@640 | 10 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@640 | 11 | |
paul@685 | 12 | mkdir -p "$PREFS/$SENDER" |
paul@1133 | 13 | echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" |
paul@685 | 14 | |
paul@1454 | 15 | # Test the recipient's initial free/busy state. |
paul@685 | 16 | |
paul@1454 | 17 | test_initial_freebusy |
paul@1454 | 18 | test_initial_freebusy_limited |
paul@594 | 19 | |
paul@1454 | 20 | # Make a new event. |
paul@594 | 21 | |
paul@1454 | 22 | cat > "event_cmd.tmp" <<EOF |
paul@1454 | 23 | new |
paul@1454 | 24 | period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo |
paul@1454 | 25 | rrule |
paul@1454 | 26 | freq monthly 1 |
paul@1454 | 27 | selection weekday FR 2 end |
paul@1454 | 28 | count 3 |
paul@1454 | 29 | end |
paul@1454 | 30 | attendance accept |
paul@1454 | 31 | attendee mailto:vincent.vole@example.com |
paul@1454 | 32 | summary Recurring event |
paul@1454 | 33 | finish |
paul@1454 | 34 | update event.tmp |
paul@1454 | 35 | publish event_self.tmp |
paul@1454 | 36 | UID event_uid.tmp |
paul@1454 | 37 | EOF |
paul@594 | 38 | |
paul@1454 | 39 | text_client "$SENDER" "event_cmd.tmp" |
paul@685 | 40 | |
paul@1454 | 41 | # Obtain the event UID. |
paul@685 | 42 | |
paul@1454 | 43 | read UID1 < "event_uid.tmp" |
paul@1454 | 44 | |
paul@1454 | 45 | # Register the event at the sender. |
paul@1088 | 46 | |
paul@1454 | 47 | outgoing_script "event_self.tmp" |
paul@685 | 48 | |
paul@1454 | 49 | # Expect free/busy periods for the sender. |
paul@1454 | 50 | |
paul@1454 | 51 | list_script "out1f.tmp" "$SENDER" "freebusy" |
paul@1454 | 52 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out1f.tmp" |
paul@685 | 53 | |
paul@1454 | 54 | # Present the request to the recipient. |
paul@1454 | 55 | |
paul@1454 | 56 | person_script "event.tmp" "out2.tmp" |
paul@1454 | 57 | |
paul@1454 | 58 | # Expect no reply because the recipient must handle the request. |
paul@594 | 59 | |
paul@1454 | 60 | is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" |
paul@594 | 61 | |
paul@1454 | 62 | # Expect no free/busy periods for the recipient. |
paul@1454 | 63 | |
paul@1454 | 64 | list_script "out2f.tmp" "$USER" "freebusy" |
paul@1454 | 65 | test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out2f.tmp" |
paul@1088 | 66 | |
paul@1454 | 67 | # Expect free/busy periods for the sender at the recipient. |
paul@1454 | 68 | |
paul@1454 | 69 | list_script "out2fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 70 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out2fo.tmp" |
paul@594 | 71 | |
paul@1454 | 72 | # Accept the invitation. |
paul@1088 | 73 | |
paul@1454 | 74 | cat > "event_accept_cmd.tmp" <<EOF |
paul@1454 | 75 | attendance accept |
paul@1454 | 76 | finish |
paul@1454 | 77 | update event_accept.tmp |
paul@1454 | 78 | EOF |
paul@594 | 79 | |
paul@1454 | 80 | text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" |
paul@685 | 81 | |
paul@1454 | 82 | # Register the acceptance at the recipient. |
paul@1454 | 83 | |
paul@1454 | 84 | outgoing_script "event_accept.tmp" |
paul@594 | 85 | |
paul@1454 | 86 | # Expect free/busy periods at the recipient. |
paul@1088 | 87 | |
paul@1454 | 88 | list_script "out2f2.tmp" "$USER" "freebusy" |
paul@1454 | 89 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out2f2.tmp" |
paul@1454 | 90 | |
paul@1454 | 91 | # Cancel a recurrence of the event. |
paul@594 | 92 | |
paul@1454 | 93 | cat > "event_cancel_cmd.tmp" <<EOF |
paul@1454 | 94 | period 1 cancel |
paul@1454 | 95 | finish |
paul@1454 | 96 | update event_cancel.tmp |
paul@1454 | 97 | EOF |
paul@685 | 98 | |
paul@1454 | 99 | text_client_specific "$SENDER" "event_cancel_cmd.tmp" "$UID1" |
paul@1454 | 100 | |
paul@1454 | 101 | # Register the cancellation at the sender. |
paul@1088 | 102 | |
paul@1454 | 103 | outgoing_script "event_cancel.tmp" |
paul@1454 | 104 | |
paul@1454 | 105 | # Expect only two periods at the sender. |
paul@685 | 106 | |
paul@1454 | 107 | list_script "out3s.tmp" "$SENDER" "freebusy" |
paul@1454 | 108 | test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out3s.tmp" |
paul@1454 | 109 | have_occurrences "$UID1" 2 "out3s.tmp" && success || failed "out3s.tmp" |
paul@685 | 110 | |
paul@1454 | 111 | # Register the cancellation at the recipient. |
paul@594 | 112 | |
paul@1454 | 113 | person_script "event_cancel.tmp" "out4.tmp" |
paul@1454 | 114 | |
paul@1454 | 115 | # Expect no reply from the recipient. |
paul@594 | 116 | |
paul@1454 | 117 | is_absent 'METHOD:REPLY' "out4.tmp" && success || failed "out4.tmp" |
paul@1454 | 118 | |
paul@1454 | 119 | # Expect only two periods at the recipient. |
paul@1088 | 120 | |
paul@1454 | 121 | list_script "out4f.tmp" "$USER" "freebusy" |
paul@1454 | 122 | test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4f.tmp" |
paul@1454 | 123 | have_occurrences "$UID1" 2 "out4f.tmp" && success || failed "out4f.tmp" |
paul@1454 | 124 | |
paul@1454 | 125 | # Expect only two periods for the sender at the recipient. |
paul@594 | 126 | |
paul@1454 | 127 | list_script "out4fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 128 | test_freebusy_missing '20141114T090000Z' '20141114T100000Z' "out4fo.tmp" |
paul@1454 | 129 | have_occurrences "$UID1" 2 "out4fo.tmp" && success || failed "out4fo.tmp" |
paul@1454 | 130 | |
paul@1454 | 131 | # Reschedule the first period |
paul@1088 | 132 | |
paul@1454 | 133 | cat > "event_reschedule_cmd.tmp" <<EOF |
paul@1454 | 134 | period 0 edit 20141011 10 00 00 Europe/Oslo 20141011 11 00 00 Europe/Oslo |
paul@1454 | 135 | finish |
paul@1454 | 136 | update event_reschedule.tmp |
paul@1454 | 137 | EOF |
paul@594 | 138 | |
paul@1454 | 139 | text_client_specific "$SENDER" "event_reschedule_cmd.tmp" "$UID1" |
paul@1454 | 140 | |
paul@1454 | 141 | # Register the rescheduling at the sender. |
paul@685 | 142 | |
paul@1454 | 143 | outgoing_script "event_reschedule.tmp" |
paul@685 | 144 | |
paul@1454 | 145 | # Expect a change in the first period at the sender. |
paul@1088 | 146 | |
paul@1454 | 147 | list_script "out4s.tmp" "$SENDER" "freebusy" |
paul@1454 | 148 | test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out4s.tmp" |
paul@1454 | 149 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out4s.tmp" |
paul@1454 | 150 | |
paul@1454 | 151 | # Register the rescheduling at the recipient. |
paul@685 | 152 | |
paul@1454 | 153 | person_script "event_reschedule.tmp" "out5.tmp" |
paul@685 | 154 | |
paul@1454 | 155 | # Expect no reply from the recipient. |
paul@1454 | 156 | |
paul@1454 | 157 | is_absent 'METHOD:REPLY' "out5.tmp" && success || failed "out5.tmp" |
paul@594 | 158 | |
paul@1454 | 159 | # Expect no change in the first period at the recipient. |
paul@594 | 160 | |
paul@1454 | 161 | list_script "out5f.tmp" "$USER" "freebusy" |
paul@1454 | 162 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out5f.tmp" |
paul@1454 | 163 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out5f.tmp" |
paul@1088 | 164 | |
paul@1454 | 165 | # Expect a change in the first period for the sender at the recipient. |
paul@594 | 166 | |
paul@1454 | 167 | list_script "out5fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 168 | test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out5fo.tmp" |
paul@1454 | 169 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out5fo.tmp" |
paul@1454 | 170 | |
paul@1454 | 171 | # Accept the rescheduling. |
paul@1088 | 172 | |
paul@1454 | 173 | cat > "event_accept2_cmd.tmp" <<EOF |
paul@1454 | 174 | attendance accept |
paul@1454 | 175 | finish |
paul@1454 | 176 | update event_accept2.tmp |
paul@1454 | 177 | EOF |
paul@594 | 178 | |
paul@1454 | 179 | text_client_specific "$USER" "event_accept2_cmd.tmp" "$UID1" '20141010T080000Z' |
paul@685 | 180 | |
paul@1454 | 181 | # Register the acceptance at the recipient. |
paul@1454 | 182 | |
paul@1454 | 183 | outgoing_script "event_accept2.tmp" |
paul@594 | 184 | |
paul@1454 | 185 | # Expect a change in the first period at the recipient. |
paul@1454 | 186 | |
paul@1454 | 187 | list_script "out6f.tmp" "$USER" "freebusy" |
paul@1454 | 188 | test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out6f.tmp" |
paul@1454 | 189 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f.tmp" |
paul@1088 | 190 | |
paul@1454 | 191 | # Prepare a complete cancellation. |
paul@594 | 192 | |
paul@1454 | 193 | cat > "event_cancel_all_cmd.tmp" <<EOF |
paul@1454 | 194 | cancel |
paul@1454 | 195 | finish |
paul@1454 | 196 | cancel event_cancel_all.tmp |
paul@1454 | 197 | EOF |
paul@1088 | 198 | |
paul@1454 | 199 | text_client_specific "$SENDER" "event_cancel_all_cmd.tmp" "$UID1" |
paul@685 | 200 | |
paul@1454 | 201 | # Register the cancellation at the sender. |
paul@1454 | 202 | |
paul@1454 | 203 | outgoing_script "event_cancel_all.tmp" |
paul@685 | 204 | |
paul@1454 | 205 | # Expect no periods at the sender. |
paul@594 | 206 | |
paul@1454 | 207 | list_script "out7s.tmp" "$SENDER" "freebusy" |
paul@1454 | 208 | have_occurrences "$UID1" 0 "out7s.tmp" && success || failed "out7s.tmp" |
paul@1454 | 209 | |
paul@1454 | 210 | # Register the cancellation at the recipient. |
paul@594 | 211 | |
paul@1454 | 212 | person_script "event_cancel_all.tmp" "out7.tmp" |
paul@1454 | 213 | |
paul@1454 | 214 | # Expect no reply from the recipient. |
paul@1088 | 215 | |
paul@1454 | 216 | is_absent 'METHOD:REPLY' "out7.tmp" && success || failed "out7.tmp" |
paul@1454 | 217 | |
paul@1454 | 218 | # Expect no periods at the recipient. |
paul@594 | 219 | |
paul@1454 | 220 | list_script "out7f.tmp" "$USER" "freebusy" |
paul@1454 | 221 | have_occurrences "$UID1" 0 "out7f.tmp" && success || failed "out7f.tmp" |
paul@1088 | 222 | |
paul@1454 | 223 | # Expect no periods for the sender at the recipient. |
paul@1454 | 224 | |
paul@1454 | 225 | list_script "out7fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 226 | have_occurrences "$UID1" 0 "out7fo.tmp" && success || failed "out7fo.tmp" |
paul@644 | 227 | |
paul@644 | 228 | # Switch time zones. |
paul@644 | 229 | |
paul@644 | 230 | echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" |
paul@644 | 231 | |
paul@1454 | 232 | # Register the event at the sender. |
paul@685 | 233 | |
paul@1454 | 234 | outgoing_script "event_self.tmp" |
paul@1454 | 235 | |
paul@1454 | 236 | # Expect free/busy periods for the sender. |
paul@1088 | 237 | |
paul@1454 | 238 | list_script "out8f.tmp" "$SENDER" "freebusy" |
paul@1454 | 239 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out8f.tmp" |
paul@685 | 240 | |
paul@1454 | 241 | # Present the request to the recipient. |
paul@644 | 242 | |
paul@1454 | 243 | person_script "event.tmp" "out9.tmp" |
paul@1454 | 244 | |
paul@1454 | 245 | # Expect no reply because the recipient must handle the request. |
paul@644 | 246 | |
paul@1454 | 247 | is_absent 'METHOD:REPLY' "out9.tmp" && success || failed "out9.tmp" |
paul@1088 | 248 | |
paul@1454 | 249 | # Expect no free/busy periods for the recipient. |
paul@1454 | 250 | |
paul@1454 | 251 | list_script "out9f.tmp" "$USER" "freebusy" |
paul@1454 | 252 | test_freebusy_missing '20141212T090000Z' '20141212T100000Z' "out9f.tmp" |
paul@644 | 253 | |
paul@1454 | 254 | # Expect free/busy periods for the sender at the recipient. |
paul@1088 | 255 | |
paul@1454 | 256 | list_script "out9fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 257 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out9fo.tmp" |
paul@644 | 258 | |
paul@1454 | 259 | text_client_specific "$USER" "event_accept_cmd.tmp" "$UID1" |
paul@1454 | 260 | |
paul@1454 | 261 | # Register the acceptance at the recipient. |
paul@644 | 262 | |
paul@1454 | 263 | outgoing_script "event_accept.tmp" |
paul@1088 | 264 | |
paul@1454 | 265 | # Expect free/busy periods at the recipient. |
paul@1454 | 266 | |
paul@1454 | 267 | list_script "out9f2.tmp" "$USER" "freebusy" |
paul@1454 | 268 | test_freebusy '20141212T090000Z' '20141212T100000Z' "out9f2.tmp" |
paul@644 | 269 | |
paul@1454 | 270 | # Cancel the event. |
paul@1454 | 271 | |
paul@1454 | 272 | outgoing_script "event_cancel_all.tmp" |
paul@685 | 273 | |
paul@1454 | 274 | # Expect no periods at the sender. |
paul@1088 | 275 | |
paul@1454 | 276 | list_script "out10s.tmp" "$SENDER" "freebusy" |
paul@1454 | 277 | have_occurrences "$UID1" 0 "out10s.tmp" && success || failed "out10s.tmp" |
paul@685 | 278 | |
paul@1454 | 279 | # Register the cancellation at the recipient. |
paul@1454 | 280 | |
paul@1454 | 281 | person_script "event_cancel_all.tmp" "out10.tmp" |
paul@644 | 282 | |
paul@1454 | 283 | # Expect no reply from the recipient. |
paul@644 | 284 | |
paul@1454 | 285 | is_absent 'METHOD:REPLY' "out10.tmp" && success || failed "out10.tmp" |
paul@1088 | 286 | |
paul@1454 | 287 | # Expect no periods at the recipient. |
paul@1454 | 288 | |
paul@1454 | 289 | list_script "out10f.tmp" "$USER" "freebusy" |
paul@1454 | 290 | have_occurrences "$UID1" 0 "out10f.tmp" && success || failed "out10f.tmp" |
paul@644 | 291 | |
paul@1454 | 292 | # Expect no periods for the sender at the recipient. |
paul@1088 | 293 | |
paul@1454 | 294 | list_script "out10fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 295 | have_occurrences "$UID1" 0 "out10fo.tmp" && success || failed "out10fo.tmp" |
paul@644 | 296 | |
paul@685 | 297 | # Test floating dates. Here, the outgoing interpretation is different because |
paul@685 | 298 | # the sender is in a different time zone. |
paul@685 | 299 | |
paul@1454 | 300 | cat > "event_floating_cmd.tmp" <<EOF |
paul@1454 | 301 | new |
paul@1454 | 302 | period 0 edit 20141010 - 20141010 - |
paul@1454 | 303 | rrule |
paul@1454 | 304 | freq monthly 1 |
paul@1454 | 305 | selection weekday FR 2 end |
paul@1454 | 306 | count 3 |
paul@1454 | 307 | end |
paul@1454 | 308 | attendee mailto:vincent.vole@example.com |
paul@1454 | 309 | summary Recurring event |
paul@1454 | 310 | list |
paul@1454 | 311 | finish |
paul@1454 | 312 | update event_floating.tmp |
paul@1454 | 313 | publish event_floating_self.tmp |
paul@1454 | 314 | UID event_floating_uid.tmp |
paul@1454 | 315 | EOF |
paul@685 | 316 | |
paul@1454 | 317 | text_client "$SENDER" "event_floating_cmd.tmp" |
paul@1454 | 318 | |
paul@1454 | 319 | # Obtain the event UID. |
paul@1454 | 320 | |
paul@1454 | 321 | read UID2 < "event_floating_uid.tmp" |
paul@644 | 322 | |
paul@1454 | 323 | # Register the event at the sender. |
paul@1454 | 324 | |
paul@1454 | 325 | outgoing_script "event_floating_self.tmp" |
paul@644 | 326 | |
paul@1454 | 327 | # Expect free/busy periods for the sender. |
paul@1454 | 328 | |
paul@1454 | 329 | list_script "out11s.tmp" "$SENDER" "freebusy" |
paul@1454 | 330 | test_freebusy '20141211T230000Z' '20141212T230000Z' "out11s.tmp" |
paul@1088 | 331 | |
paul@1454 | 332 | # Present the request to the recipient. |
paul@1454 | 333 | |
paul@1454 | 334 | person_script "event_floating.tmp" "out11.tmp" |
paul@1454 | 335 | |
paul@1454 | 336 | # Expect no reply because the recipient must handle the request. |
paul@1454 | 337 | |
paul@1454 | 338 | is_absent 'METHOD:REPLY' "out11.tmp" && success || failed "out11.tmp" |
paul@644 | 339 | |
paul@1454 | 340 | # Expect no free/busy periods for the recipient (in either time zone). |
paul@697 | 341 | |
paul@1454 | 342 | list_script "out11f.tmp" "$USER" "freebusy" |
paul@1454 | 343 | test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11f.tmp" |
paul@1454 | 344 | test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11f.tmp" |
paul@1454 | 345 | |
paul@1454 | 346 | # Expect no free/busy periods for the sender at the recipient. |
paul@1454 | 347 | # The organiser is not attending. |
paul@1088 | 348 | |
paul@1454 | 349 | list_script "out11fo.tmp" "$USER" "freebusy_other" "$SENDER" |
paul@1454 | 350 | test_freebusy_missing '20141211T220000Z' '20141212T220000Z' "out11fo.tmp" |
paul@1454 | 351 | test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out11fo.tmp" |
paul@1454 | 352 | |
paul@1454 | 353 | # Accept the invitation. |
paul@1454 | 354 | |
paul@1454 | 355 | text_client_specific "$USER" "event_accept_cmd.tmp" "$UID2" |
paul@644 | 356 | |
paul@1454 | 357 | # Register the acceptance at the recipient. |
paul@1454 | 358 | |
paul@1454 | 359 | outgoing_script "event_accept.tmp" |
paul@644 | 360 | |
paul@1454 | 361 | # Expect free/busy periods at the recipient (in the appropriate time zone). |
paul@1088 | 362 | |
paul@1454 | 363 | list_script "out12f.tmp" "$USER" "freebusy" |
paul@1454 | 364 | test_freebusy '20141211T220000Z' '20141212T220000Z' "out12f.tmp" |
paul@1454 | 365 | test_freebusy_missing '20141211T230000Z' '20141212T230000Z' "out12f.tmp" |