paul@1123 | 1 | #!/bin/sh |
paul@1123 | 2 | |
paul@1123 | 3 | . "`dirname \"$0\"`/common.sh" |
paul@1123 | 4 | |
paul@1133 | 5 | USER1="mailto:vincent.vole@example.com" |
paul@1133 | 6 | USER2="mailto:harvey.horse@example.com" |
paul@1123 | 7 | SENDER="mailto:paul.boddie@example.com" |
paul@1123 | 8 | |
paul@1133 | 9 | mkdir -p "$PREFS/$USER1" |
paul@1133 | 10 | echo 'Europe/Oslo' > "$PREFS/$USER1/TZID" |
paul@1133 | 11 | echo 'share' > "$PREFS/$USER1/freebusy_sharing" |
paul@1133 | 12 | |
paul@1133 | 13 | mkdir -p "$PREFS/$USER2" |
paul@1133 | 14 | echo 'Europe/Oslo' > "$PREFS/$USER2/TZID" |
paul@1133 | 15 | echo 'share' > "$PREFS/$USER2/freebusy_sharing" |
paul@1123 | 16 | |
paul@1123 | 17 | mkdir -p "$PREFS/$SENDER" |
paul@1133 | 18 | echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID" |
paul@1123 | 19 | |
paul@1449 | 20 | # Test the recipient's initial free/busy state. |
paul@1123 | 21 | |
paul@1449 | 22 | test_initial_freebusy |
paul@1449 | 23 | test_initial_freebusy_limited |
paul@1123 | 24 | |
paul@1449 | 25 | # Make a new event. |
paul@1123 | 26 | |
paul@1449 | 27 | cat > "event_cmd.tmp" <<EOF |
paul@1449 | 28 | new |
paul@1449 | 29 | period 0 edit 20141010 10 00 00 Europe/Oslo 20141010 11 00 00 Europe/Oslo |
paul@1449 | 30 | period new 20141011 10 00 00 Europe/Oslo 20141011 11 00 00 Europe/Oslo |
paul@1449 | 31 | attendance accept |
paul@1449 | 32 | attendee mailto:vincent.vole@example.com |
paul@1449 | 33 | attendee mailto:harvey.horse@example.com |
paul@1449 | 34 | summary Recurring event |
paul@1449 | 35 | finish |
paul@1449 | 36 | update event.tmp |
paul@1449 | 37 | publish event_self.tmp |
paul@1449 | 38 | UID event_uid.tmp |
paul@1449 | 39 | EOF |
paul@1123 | 40 | |
paul@1449 | 41 | text_client "$SENDER" "event_cmd.tmp" |
paul@1449 | 42 | |
paul@1449 | 43 | # Obtain the event UID. |
paul@1449 | 44 | |
paul@1449 | 45 | read UID1 < "event_uid.tmp" |
paul@1123 | 46 | |
paul@1449 | 47 | # Register the event at the sender. |
paul@1449 | 48 | |
paul@1449 | 49 | outgoing_script "event_self.tmp" |
paul@1123 | 50 | |
paul@1449 | 51 | # Expect free/busy periods at the sender. |
paul@1449 | 52 | |
paul@1449 | 53 | list_script "out1f.tmp" "$SENDER" "freebusy" |
paul@1449 | 54 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out1f.tmp" |
paul@1123 | 55 | |
paul@1127 | 56 | # There should be an event created by the sender. |
paul@1127 | 57 | |
paul@1449 | 58 | list_script "out1O.tmp" "$SENDER" "object" "$UID1" |
paul@1449 | 59 | is_present "$UID1" "out1O.tmp" && success || failed "out1O.tmp" |
paul@1127 | 60 | |
paul@1449 | 61 | # Present the event to the recipients. |
paul@1123 | 62 | |
paul@1449 | 63 | person_script "event.tmp" "out2.tmp" |
paul@1449 | 64 | |
paul@1449 | 65 | # Expect no reply because the recipients must handle the request. |
paul@1123 | 66 | |
paul@1449 | 67 | is_absent 'METHOD:REPLY' "out2.tmp" && success || failed "out2.tmp" |
paul@1123 | 68 | |
paul@1449 | 69 | # Expect no free/busy periods for the recipients. |
paul@1123 | 70 | |
paul@1449 | 71 | list_script "out2f1.tmp" "$USER1" "freebusy" |
paul@1449 | 72 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out2f1.tmp" |
paul@1123 | 73 | |
paul@1449 | 74 | list_script "out2f2.tmp" "$USER2" "freebusy" |
paul@1449 | 75 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out2f2.tmp" |
paul@1123 | 76 | |
paul@1449 | 77 | # Expect free/busy periods for the sender at the recipients. |
paul@1133 | 78 | |
paul@1449 | 79 | list_script "out2fo1.tmp" "$USER1" "freebusy_other" "$SENDER" |
paul@1449 | 80 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out2fo1.tmp" |
paul@1133 | 81 | |
paul@1449 | 82 | list_script "out2fo2.tmp" "$USER2" "freebusy_other" "$SENDER" |
paul@1449 | 83 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out2fo2.tmp" |
paul@1133 | 84 | |
paul@1127 | 85 | # There should be an event created by the sender. |
paul@1127 | 86 | |
paul@1449 | 87 | list_script "out2O1.tmp" "$USER1" "object" "$UID1" |
paul@1449 | 88 | is_present "$UID1" "out2O1.tmp" && success || failed "out2O1.tmp" |
paul@1127 | 89 | |
paul@1449 | 90 | list_script "out2O2.tmp" "$USER1" "object" "$UID1" |
paul@1449 | 91 | is_present "$UID1" "out2O2.tmp" && success || failed "out2O2.tmp" |
paul@1127 | 92 | |
paul@1449 | 93 | # Accept the invitation. |
paul@1133 | 94 | |
paul@1449 | 95 | cat > "event_accept1_cmd.tmp" <<EOF |
paul@1449 | 96 | attendance accept |
paul@1449 | 97 | finish |
paul@1449 | 98 | update event_accept1.tmp |
paul@1449 | 99 | EOF |
paul@1123 | 100 | |
paul@1449 | 101 | sed 's/event_accept1.tmp/event_accept2.tmp/' "event_accept1_cmd.tmp" \ |
paul@1449 | 102 | > "event_accept2_cmd.tmp" |
paul@1123 | 103 | |
paul@1449 | 104 | text_client_specific "$USER1" "event_accept1_cmd.tmp" "$UID1" |
paul@1449 | 105 | text_client_specific "$USER2" "event_accept2_cmd.tmp" "$UID1" |
paul@1123 | 106 | |
paul@1449 | 107 | # Register the acceptance at the recipients. |
paul@1123 | 108 | |
paul@1449 | 109 | outgoing_script "event_accept1.tmp" |
paul@1449 | 110 | outgoing_script "event_accept2.tmp" |
paul@1449 | 111 | |
paul@1449 | 112 | # Expect free/busy periods at the recipients. |
paul@1133 | 113 | |
paul@1449 | 114 | list_script "out3f1.tmp" "$USER1" "freebusy" |
paul@1449 | 115 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out3f1.tmp" |
paul@1133 | 116 | |
paul@1449 | 117 | list_script "out3f2.tmp" "$USER2" "freebusy" |
paul@1449 | 118 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out3f2.tmp" |
paul@1133 | 119 | |
paul@1123 | 120 | # Test registration in the incoming handler. |
paul@1123 | 121 | |
paul@1449 | 122 | person_script "event_accept1.tmp" "out4i1.tmp" |
paul@1449 | 123 | list_script "out4f1.tmp" "$SENDER" "freebusy_other" "$USER1" |
paul@1449 | 124 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out4f1.tmp" |
paul@1449 | 125 | list_script "out4f2v1.tmp" "$SENDER" "freebusy_other" "$USER2" |
paul@1449 | 126 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out4f2v1.tmp" |
paul@1123 | 127 | |
paul@1449 | 128 | person_script "event_accept2.tmp" "out4i2.tmp" |
paul@1449 | 129 | list_script "out4f2v2.tmp" "$SENDER" "freebusy_other" "$USER1" |
paul@1449 | 130 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out4f2v2.tmp" |
paul@1123 | 131 | |
paul@1449 | 132 | # Decline the invitation to the recurrence for the first user. |
paul@1133 | 133 | |
paul@1449 | 134 | cat > "event_decline1_cmd.tmp" <<EOF |
paul@1449 | 135 | attendance decline |
paul@1449 | 136 | finish |
paul@1449 | 137 | update event_decline1.tmp |
paul@1449 | 138 | EOF |
paul@1123 | 139 | |
paul@1449 | 140 | text_client_specific "$USER1" "event_decline1_cmd.tmp" "$UID1" '20141011T080000Z' |
paul@1133 | 141 | |
paul@1449 | 142 | # Register the rejection at the user. |
paul@1133 | 143 | |
paul@1449 | 144 | outgoing_script "event_decline1.tmp" |
paul@1123 | 145 | |
paul@1449 | 146 | # Expect only one free/busy period at the user. |
paul@1123 | 147 | |
paul@1449 | 148 | list_script "out5s.tmp" "$USER1" "freebusy" |
paul@1449 | 149 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out5s.tmp" |
paul@1449 | 150 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out5s.tmp" |
paul@1123 | 151 | |
paul@1127 | 152 | # There should be a recurrence created by the user. |
paul@1127 | 153 | |
paul@1449 | 154 | list_script "out5O.tmp" "$USER1" "object" "$UID1" |
paul@1449 | 155 | is_present "$UID1" "out5O.tmp" && success || failed "out5O.tmp" |
paul@1127 | 156 | |
paul@1449 | 157 | list_script "out5R.tmp" "$USER1" "recurrence" "$UID1" '20141011T080000Z' |
paul@1449 | 158 | is_present "$UID1" "out5R.tmp" && success || failed "out5R.tmp" |
paul@1127 | 159 | |
paul@1449 | 160 | # Register the rejection at the sender. |
paul@1123 | 161 | |
paul@1449 | 162 | person_script "event_decline1.tmp" "out6.tmp" |
paul@1123 | 163 | |
paul@1449 | 164 | # Expect two free/busy periods for the sender. |
paul@1123 | 165 | |
paul@1449 | 166 | list_script "out6f.tmp" "$SENDER" "freebusy" |
paul@1449 | 167 | have_occurrences "$UID1" 2 "out6f.tmp" && success || failed "out6f.tmp" |
paul@1449 | 168 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out6f.tmp" |
paul@1449 | 169 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f.tmp" |
paul@1123 | 170 | |
paul@1449 | 171 | # Expect one free/busy period for the first user at the sender. |
paul@1123 | 172 | |
paul@1449 | 173 | list_script "out6o1.tmp" "$SENDER" "freebusy_other" "$USER1" |
paul@1449 | 174 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out6o1.tmp" |
paul@1449 | 175 | test_freebusy_missing '20141011T080000Z' '20141011T090000Z' "out6o1.tmp" |
paul@1133 | 176 | |
paul@1449 | 177 | # Expect two free/busy periods for the second user at the sender. |
paul@1133 | 178 | |
paul@1449 | 179 | list_script "out6o2.tmp" "$SENDER" "freebusy_other" "$USER2" |
paul@1449 | 180 | have_occurrences "$UID1" 2 "out6o2.tmp" && success || failed "out6o2.tmp" |
paul@1449 | 181 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out6o2.tmp" |
paul@1449 | 182 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out6o2.tmp" |
paul@1133 | 183 | |
paul@1127 | 184 | # There should be a recurrence created by the user. |
paul@1127 | 185 | |
paul@1449 | 186 | list_script "out6O.tmp" "$SENDER" "object" "$UID1" |
paul@1449 | 187 | is_present "$UID1" "out6O.tmp" && success || failed "out6O.tmp" |
paul@1127 | 188 | |
paul@1449 | 189 | list_script "out6R.tmp" "$SENDER" "recurrence" "$UID1" '20141011T080000Z' |
paul@1449 | 190 | is_present "$UID1" "out6R.tmp" && success || failed "out6R.tmp" |
paul@1128 | 191 | |
paul@1134 | 192 | # This should cause the organiser to tell the second user about the recurrence. |
paul@1134 | 193 | |
paul@1449 | 194 | is_present 'METHOD:REQUEST' "out6.tmp" && success || failed "out6.tmp" |
paul@1449 | 195 | |
paul@1449 | 196 | # Present the update to the second user. |
paul@1449 | 197 | |
paul@1449 | 198 | person_script "out6.tmp" "out62.tmp" |
paul@1134 | 199 | |
paul@1449 | 200 | # There should be a recurrence created by the first user at the second user. |
paul@1134 | 201 | |
paul@1449 | 202 | list_script "out6O2.tmp" "$USER2" "object" "$UID1" |
paul@1449 | 203 | is_present "$UID1" "out6O2.tmp" && success || failed "out6O2.tmp" |
paul@1134 | 204 | |
paul@1449 | 205 | list_script "out6R2.tmp" "$USER2" "recurrence" "$UID1" '20141011T080000Z' |
paul@1449 | 206 | is_present "$UID1" "out6R2.tmp" && success || failed "out6R2.tmp" |
paul@1134 | 207 | |
paul@1134 | 208 | # The second user's schedule should remain unchanged. |
paul@1134 | 209 | # NOTE: The nature of the periods might need to change, with the recurrence |
paul@1134 | 210 | # NOTE: taking over the affected period. |
paul@1134 | 211 | |
paul@1449 | 212 | list_script "out6f2.tmp" "$USER2" "freebusy" |
paul@1449 | 213 | have_occurrences "$UID1" 2 "out6f2.tmp" && success || failed "out6f2.tmp" |
paul@1449 | 214 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out6f2.tmp" |
paul@1449 | 215 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out6f2.tmp" |
paul@1134 | 216 | |
paul@1449 | 217 | # Accept the invitation for the recurrence at the first user. |
paul@1134 | 218 | |
paul@1449 | 219 | sed 's/event_accept1.tmp/event_accept1r.tmp/' "event_accept1_cmd.tmp" \ |
paul@1449 | 220 | > "event_accept1r_cmd.tmp" |
paul@1128 | 221 | |
paul@1449 | 222 | text_client_specific "$USER1" "event_accept1r_cmd.tmp" "$UID1" '20141011T080000Z' |
paul@1449 | 223 | |
paul@1449 | 224 | # Register acceptance in the outgoing handler. |
paul@1449 | 225 | |
paul@1449 | 226 | outgoing_script "event_accept1r.tmp" |
paul@1128 | 227 | |
paul@1449 | 228 | # Expect both periods in the user's free/busy collection. |
paul@1128 | 229 | |
paul@1449 | 230 | list_script "out7f.tmp" "$USER1" "freebusy" |
paul@1449 | 231 | have_occurrences "$UID1" 2 "out7f.tmp" && success || failed "out7f.tmp" |
paul@1449 | 232 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out7f.tmp" |
paul@1449 | 233 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out7f.tmp" |
paul@1128 | 234 | |
paul@1128 | 235 | # There should still be a recurrence created by the user. |
paul@1128 | 236 | |
paul@1449 | 237 | list_script "out7O.tmp" "$USER1" "object" "$UID1" |
paul@1449 | 238 | is_present "$UID1" "out7O.tmp" && success || failed "out7O.tmp" |
paul@1128 | 239 | |
paul@1449 | 240 | list_script "out7R.tmp" "$USER1" "recurrence" "$UID1" '20141011T080000Z' |
paul@1449 | 241 | is_present "$UID1" "out7R.tmp" && success || failed "out7R.tmp" |
paul@1128 | 242 | |
paul@1449 | 243 | # Register the acceptance at the sender. |
paul@1128 | 244 | |
paul@1449 | 245 | person_script "event_accept1r.tmp" "out8.tmp" |
paul@1449 | 246 | |
paul@1449 | 247 | # Expect both periods in the sender's free/busy collection. |
paul@1128 | 248 | |
paul@1449 | 249 | list_script "out8f.tmp" "$SENDER" "freebusy" |
paul@1449 | 250 | have_occurrences "$UID1" 2 "out8f.tmp" && success || failed "out8f.tmp" |
paul@1449 | 251 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out8f.tmp" |
paul@1449 | 252 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out8f.tmp" |
paul@1128 | 253 | |
paul@1449 | 254 | # Expect both periods for the first user at the sender. |
paul@1128 | 255 | |
paul@1449 | 256 | list_script "out8o1.tmp" "$SENDER" "freebusy_other" "$USER1" |
paul@1449 | 257 | have_occurrences "$UID1" 2 "out8o1.tmp" && success || failed "out8o1.tmp" |
paul@1449 | 258 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out8o1.tmp" |
paul@1449 | 259 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out8o1.tmp" |
paul@1128 | 260 | |
paul@1133 | 261 | # The second user should not have been affected. |
paul@1133 | 262 | |
paul@1449 | 263 | list_script "out8o2.tmp" "$SENDER" "freebusy_other" "$USER2" |
paul@1449 | 264 | have_occurrences "$UID1" 2 "out8o2.tmp" && success || failed "out8o2.tmp" |
paul@1449 | 265 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out8o2.tmp" |
paul@1449 | 266 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out8o2.tmp" |
paul@1133 | 267 | |
paul@1128 | 268 | # There should be a recurrence created by the user. |
paul@1128 | 269 | |
paul@1449 | 270 | list_script "out8O.tmp" "$SENDER" "object" "$UID1" |
paul@1449 | 271 | is_present "$UID1" "out8O.tmp" && success || failed "out8O.tmp" |
paul@1128 | 272 | |
paul@1449 | 273 | list_script "out8R.tmp" "$SENDER" "recurrence" "$UID1" '20141011T080000Z' |
paul@1449 | 274 | is_present "$UID1" "out8R.tmp" && success || failed "out8R.tmp" |
paul@1134 | 275 | |
paul@1134 | 276 | # Test recurrence declining in the outgoing handler. |
paul@1134 | 277 | # Now the second user declines the parent event. |
paul@1134 | 278 | |
paul@1449 | 279 | sed 's/event_decline1.tmp/event_decline2.tmp/' "event_decline1_cmd.tmp" \ |
paul@1449 | 280 | > "event_decline2_cmd.tmp" |
paul@1449 | 281 | |
paul@1449 | 282 | text_client_specific "$USER2" "event_decline2_cmd.tmp" "$UID1" |
paul@1449 | 283 | |
paul@1449 | 284 | # Register acceptance in the outgoing handler. |
paul@1134 | 285 | |
paul@1449 | 286 | outgoing_script "event_decline2.tmp" |
paul@1449 | 287 | |
paul@1449 | 288 | # Expect only the recurrence period for the second user. |
paul@1134 | 289 | |
paul@1449 | 290 | list_script "out9s.tmp" "$USER2" "freebusy" |
paul@1449 | 291 | have_occurrences "$UID1" 1 "out9s.tmp" && success || failed "out9s.tmp" |
paul@1449 | 292 | test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out9s.tmp" |
paul@1449 | 293 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out9s.tmp" |
paul@1134 | 294 | |
paul@1134 | 295 | # Test declining in the incoming handler. |
paul@1134 | 296 | |
paul@1449 | 297 | person_script "event_decline2.tmp" "out10.tmp" |
paul@1134 | 298 | |
paul@1449 | 299 | # Expect periods for the organiser as before. |
paul@1134 | 300 | |
paul@1449 | 301 | list_script "out10f.tmp" "$SENDER" "freebusy" |
paul@1449 | 302 | have_occurrences "$UID1" 2 "out10f.tmp" && success || failed "out10f.tmp" |
paul@1449 | 303 | test_freebusy '20141010T080000Z' '20141010T090000Z' "out10f.tmp" |
paul@1449 | 304 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out10f.tmp" |
paul@1134 | 305 | |
paul@1449 | 306 | # Expect only the recurrence period for the second user at the organiser. |
paul@1134 | 307 | |
paul@1449 | 308 | list_script "out10o2.tmp" "$SENDER" "freebusy_other" "$USER2" |
paul@1449 | 309 | have_occurrences "$UID1" 1 "out10o2.tmp" && success || failed "out10o2.tmp" |
paul@1449 | 310 | test_freebusy_missing '20141010T080000Z' '20141010T090000Z' "out10o2.tmp" |
paul@1449 | 311 | test_freebusy '20141011T080000Z' '20141011T090000Z' "out10o2.tmp" |