imip-agent

Annotated tests/test_person_invitation_decline_instance.sh

1343:f184dc45aadf
2017-10-18 Paul Boddie Attempt to prevent erroneous store type configuration overriding.
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@1123 20
# Test free/busy responses.
paul@1123 21
paul@1123 22
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
paul@1123 23
| "$SHOWMAIL" \
paul@1123 24
> out0.tmp
paul@1123 25
paul@1123 26
   grep -q 'METHOD:REPLY' out0.tmp \
paul@1123 27
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@1123 28
&& echo "Success" \
paul@1123 29
|| echo "Failed"
paul@1123 30
paul@1123 31
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \
paul@1123 32
| "$SHOWMAIL" \
paul@1123 33
> out1.tmp
paul@1123 34
paul@1123 35
   grep -q 'METHOD:REPLY' out1.tmp \
paul@1123 36
&& ! grep -q '^FREEBUSY' out1.tmp \
paul@1123 37
&& echo "Success" \
paul@1123 38
|| echo "Failed"
paul@1123 39
paul@1123 40
# Publish an event, testing registration in the outgoing handler.
paul@1123 41
paul@1123 42
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-rdate.txt" 2>> $ERROR
paul@1123 43
paul@1123 44
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1123 45
>  out1f.tmp
paul@1123 46
paul@1123 47
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out1f.tmp" \
paul@1123 48
&& echo "Success" \
paul@1123 49
|| echo "Failed"
paul@1123 50
paul@1127 51
# There should be an event created by the sender.
paul@1127 52
paul@1127 53
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \
paul@1127 54
>  out1O.tmp
paul@1127 55
paul@1127 56
   grep -q 'event26@example.com' "out1O.tmp" \
paul@1127 57
&& echo "Success" \
paul@1127 58
|| echo "Failed"
paul@1127 59
paul@1133 60
# Test registration in the incoming handler for the recipients.
paul@1123 61
paul@1123 62
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-rdate.txt" 2>> $ERROR \
paul@1123 63
| "$SHOWMAIL" \
paul@1123 64
> out2.tmp
paul@1123 65
paul@1123 66
   ! grep -q 'METHOD:REPLY' out2.tmp \
paul@1123 67
&& echo "Success" \
paul@1123 68
|| echo "Failed"
paul@1123 69
paul@1133 70
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1123 71
>  out2f.tmp
paul@1123 72
paul@1123 73
   ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2f.tmp" \
paul@1123 74
&& echo "Success" \
paul@1123 75
|| echo "Failed"
paul@1123 76
paul@1133 77
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy_other" "$SENDER" \
paul@1123 78
>  out2o.tmp
paul@1123 79
paul@1123 80
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2o.tmp" \
paul@1123 81
&& echo "Success" \
paul@1123 82
|| echo "Failed"
paul@1123 83
paul@1133 84
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \
paul@1133 85
>  out2f2.tmp
paul@1133 86
paul@1133 87
   ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2f2.tmp" \
paul@1133 88
&& echo "Success" \
paul@1133 89
|| echo "Failed"
paul@1133 90
paul@1133 91
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy_other" "$SENDER" \
paul@1133 92
>  out2o2.tmp
paul@1133 93
paul@1133 94
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out2o2.tmp" \
paul@1133 95
&& echo "Success" \
paul@1133 96
|| echo "Failed"
paul@1133 97
paul@1127 98
# There should be an event created by the sender.
paul@1127 99
paul@1133 100
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "object" "event26@example.com" \
paul@1127 101
>  out2O.tmp
paul@1127 102
paul@1127 103
   grep -q 'event26@example.com' "out2O.tmp" \
paul@1127 104
&& echo "Success" \
paul@1127 105
|| echo "Failed"
paul@1127 106
paul@1133 107
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "object" "event26@example.com" \
paul@1133 108
>  out2O2.tmp
paul@1133 109
paul@1133 110
   grep -q 'event26@example.com' "out2O2.tmp" \
paul@1133 111
&& echo "Success" \
paul@1133 112
|| echo "Failed"
paul@1133 113
paul@1123 114
# Test acceptance and registration in the outgoing handler.
paul@1123 115
paul@1133 116
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER1" "event26@example.com" 2>> $ERROR \
paul@1123 117
| tee out3.tmp \
paul@1123 118
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@1123 119
paul@1133 120
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1123 121
>  out3f.tmp
paul@1123 122
paul@1123 123
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out3f.tmp" \
paul@1123 124
&& echo "Success" \
paul@1123 125
|| echo "Failed"
paul@1123 126
paul@1133 127
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER2" "event26@example.com" 2>> $ERROR \
paul@1133 128
| tee out32.tmp \
paul@1133 129
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@1133 130
paul@1133 131
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1133 132
>  out3f2.tmp
paul@1133 133
paul@1133 134
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out3f2.tmp" \
paul@1133 135
&& echo "Success" \
paul@1133 136
|| echo "Failed"
paul@1133 137
paul@1123 138
# Test registration in the incoming handler.
paul@1123 139
paul@1123 140
  "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
paul@1123 141
| "$SHOWMAIL" \
paul@1123 142
> out4.tmp
paul@1123 143
paul@1133 144
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1123 145
>  out4f.tmp
paul@1123 146
paul@1123 147
   [ `grep "event26@example.com" "out4f.tmp" | wc -l` = '2' ] \
paul@1123 148
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4f.tmp" \
paul@1123 149
&& echo "Success" \
paul@1123 150
|| echo "Failed"
paul@1123 151
paul@1133 152
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy_other" "$SENDER" \
paul@1123 153
>  out4o.tmp
paul@1123 154
paul@1123 155
   [ `grep "event26@example.com" "out4o.tmp" | wc -l` = '2' ] \
paul@1123 156
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4o.tmp" \
paul@1123 157
&& echo "Success" \
paul@1123 158
|| echo "Failed"
paul@1123 159
paul@1133 160
  "$PERSON_SCRIPT" $ARGS < out32.tmp 2>> $ERROR \
paul@1133 161
| "$SHOWMAIL" \
paul@1133 162
> out42.tmp
paul@1133 163
paul@1133 164
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \
paul@1133 165
>  out4f2.tmp
paul@1133 166
paul@1133 167
   [ `grep "event26@example.com" "out4f2.tmp" | wc -l` = '2' ] \
paul@1133 168
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4f2.tmp" \
paul@1133 169
&& echo "Success" \
paul@1133 170
|| echo "Failed"
paul@1123 171
paul@1133 172
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy_other" "$SENDER" \
paul@1133 173
>  out4o2.tmp
paul@1133 174
paul@1133 175
   [ `grep "event26@example.com" "out4o2.tmp" | wc -l` = '2' ] \
paul@1133 176
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out4o2.tmp" \
paul@1133 177
&& echo "Success" \
paul@1133 178
|| echo "Failed"
paul@1133 179
paul@1133 180
# Test recurrence declining in the outgoing handler.
paul@1133 181
# Only the first user declines.
paul@1133 182
paul@1133 183
  "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER1" "20141011T100000" "20141011T110000" "event26@example.com" "20141011T100000" 2>> $ERROR \
paul@1123 184
| tee out5.tmp \
paul@1123 185
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@1123 186
paul@1133 187
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1123 188
>  out5s.tmp
paul@1123 189
paul@1123 190
   [ `grep "event26@example.com" "out5s.tmp" | wc -l` = '1' ] \
paul@1123 191
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5s.tmp" \
paul@1123 192
&& echo "Success" \
paul@1123 193
|| echo "Failed"
paul@1123 194
paul@1127 195
# There should be a recurrence created by the user.
paul@1127 196
paul@1133 197
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "object" "event26@example.com" \
paul@1127 198
>  out5O.tmp
paul@1127 199
paul@1133 200
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "recurrence" "event26@example.com" "20141011T100000" \
paul@1127 201
>  out5R.tmp
paul@1127 202
paul@1127 203
   grep -q 'event26@example.com' "out5O.tmp" \
paul@1127 204
&& grep -q 'event26@example.com' "out5R.tmp" \
paul@1127 205
&& echo "Success" \
paul@1127 206
|| echo "Failed"
paul@1127 207
paul@1127 208
# Test declining in the incoming handler.
paul@1123 209
paul@1123 210
  "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
paul@1138 211
| tee out6r.tmp \
paul@1123 212
| "$SHOWMAIL" \
paul@1123 213
> out6.tmp
paul@1123 214
paul@1123 215
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1123 216
>  out6f.tmp
paul@1123 217
paul@1123 218
   [ `grep "event26@example.com" "out6f.tmp" | wc -l` = '2' ] \
paul@1123 219
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f.tmp" \
paul@1123 220
&& echo "Success" \
paul@1123 221
|| echo "Failed"
paul@1123 222
paul@1133 223
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER1" \
paul@1123 224
>  out6o.tmp
paul@1123 225
paul@1123 226
   [ `grep "event26@example.com" "out6o.tmp" | wc -l` = '1' ] \
paul@1123 227
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6o.tmp" \
paul@1123 228
&& echo "Success" \
paul@1123 229
|| echo "Failed"
paul@1127 230
paul@1133 231
# The second user is still attending the original event.
paul@1133 232
paul@1133 233
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER2" \
paul@1133 234
>  out6o2.tmp
paul@1133 235
paul@1133 236
   [ `grep "event26@example.com" "out6o2.tmp" | wc -l` = '2' ] \
paul@1133 237
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6o2.tmp" \
paul@1133 238
&& echo "Success" \
paul@1133 239
|| echo "Failed"
paul@1133 240
paul@1127 241
# There should be a recurrence created by the user.
paul@1127 242
paul@1127 243
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \
paul@1127 244
>  out6O.tmp
paul@1127 245
paul@1127 246
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event26@example.com" "20141011T100000" \
paul@1127 247
>  out6R.tmp
paul@1127 248
paul@1127 249
   grep -q 'event26@example.com' "out6O.tmp" \
paul@1127 250
&& grep -q 'event26@example.com' "out6R.tmp" \
paul@1127 251
&& echo "Success" \
paul@1127 252
|| echo "Failed"
paul@1128 253
paul@1134 254
# This should cause the organiser to tell the second user about the recurrence.
paul@1134 255
paul@1134 256
   grep -q 'METHOD:REQUEST' out6.tmp \
paul@1134 257
&& echo "Success" \
paul@1134 258
|| echo "Failed"
paul@1134 259
paul@1138 260
  "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \
paul@1134 261
| "$SHOWMAIL" \
paul@1134 262
> out62.tmp
paul@1134 263
paul@1134 264
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "object" "event26@example.com" \
paul@1134 265
>  out6O2.tmp
paul@1134 266
paul@1134 267
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "recurrence" "event26@example.com" "20141011T100000" \
paul@1134 268
>  out6R2.tmp
paul@1134 269
paul@1134 270
# The second user's schedule should remain unchanged.
paul@1134 271
# NOTE: The nature of the periods might need to change, with the recurrence
paul@1134 272
# NOTE: taking over the affected period.
paul@1134 273
paul@1134 274
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \
paul@1134 275
>  out6f2.tmp
paul@1134 276
paul@1134 277
   [ `grep "event26@example.com" "out6f2.tmp" | wc -l` = '2' ] \
paul@1134 278
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f2.tmp" \
paul@1134 279
&& echo "Success" \
paul@1134 280
|| echo "Failed"
paul@1134 281
paul@1128 282
# Test recurrence acceptance in the outgoing handler.
paul@1128 283
paul@1133 284
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER1" "20141011T100000" "20141011T110000" "event26@example.com" "20141011T100000" 2>> $ERROR \
paul@1128 285
| tee out7.tmp \
paul@1128 286
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@1128 287
paul@1133 288
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \
paul@1128 289
>  out7s.tmp
paul@1128 290
paul@1128 291
   [ `grep "event26@example.com" "out7s.tmp" | wc -l` = '2' ] \
paul@1128 292
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out7s.tmp" \
paul@1128 293
&& echo "Success" \
paul@1128 294
|| echo "Failed"
paul@1128 295
paul@1128 296
# There should still be a recurrence created by the user.
paul@1128 297
paul@1133 298
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "object" "event26@example.com" \
paul@1128 299
>  out7O.tmp
paul@1128 300
paul@1133 301
   "$LIST_SCRIPT" $LIST_ARGS "$USER1" "recurrence" "event26@example.com" "20141011T100000" \
paul@1128 302
>  out7R.tmp
paul@1128 303
paul@1128 304
   grep -q 'event26@example.com' "out7O.tmp" \
paul@1128 305
&& grep -q 'event26@example.com' "out7R.tmp" \
paul@1128 306
&& echo "Success" \
paul@1128 307
|| echo "Failed"
paul@1128 308
paul@1128 309
# Test acceptance in the incoming handler.
paul@1128 310
paul@1128 311
  "$PERSON_SCRIPT" $ARGS < out7.tmp 2>> $ERROR \
paul@1128 312
| "$SHOWMAIL" \
paul@1128 313
> out8.tmp
paul@1128 314
paul@1128 315
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1128 316
>  out8f.tmp
paul@1128 317
paul@1128 318
   [ `grep "event26@example.com" "out8f.tmp" | wc -l` = '2' ] \
paul@1128 319
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out8f.tmp" \
paul@1128 320
&& echo "Success" \
paul@1128 321
|| echo "Failed"
paul@1128 322
paul@1133 323
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER1" \
paul@1128 324
>  out8o.tmp
paul@1128 325
paul@1128 326
   [ `grep "event26@example.com" "out8o.tmp" | wc -l` = '2' ] \
paul@1128 327
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out8o.tmp" \
paul@1128 328
&& echo "Success" \
paul@1128 329
|| echo "Failed"
paul@1128 330
paul@1133 331
# The second user should not have been affected.
paul@1133 332
paul@1133 333
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER2" \
paul@1133 334
>  out8o2.tmp
paul@1133 335
paul@1133 336
   [ `grep "event26@example.com" "out8o2.tmp" | wc -l` = '2' ] \
paul@1133 337
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out8o2.tmp" \
paul@1133 338
&& echo "Success" \
paul@1133 339
|| echo "Failed"
paul@1133 340
paul@1128 341
# There should be a recurrence created by the user.
paul@1128 342
paul@1128 343
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event26@example.com" \
paul@1128 344
>  out8O.tmp
paul@1128 345
paul@1128 346
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event26@example.com" "20141011T100000" \
paul@1128 347
>  out8R.tmp
paul@1128 348
paul@1128 349
   grep -q 'event26@example.com' "out8O.tmp" \
paul@1128 350
&& grep -q 'event26@example.com' "out8R.tmp" \
paul@1128 351
&& echo "Success" \
paul@1128 352
|| echo "Failed"
paul@1134 353
paul@1134 354
# Test recurrence declining in the outgoing handler.
paul@1134 355
# Now the second user declines the parent event.
paul@1134 356
paul@1134 357
  "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER2" "event26@example.com" 2>> $ERROR \
paul@1134 358
| tee out9.tmp \
paul@1134 359
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@1134 360
paul@1134 361
   "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \
paul@1134 362
>  out9s.tmp
paul@1134 363
paul@1134 364
   [ `grep "event26@example.com" "out9s.tmp" | wc -l` = '0' ] \
paul@1134 365
&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out9s.tmp" \
paul@1134 366
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out9s.tmp" \
paul@1134 367
&& echo "Success" \
paul@1134 368
|| echo "Failed"
paul@1134 369
paul@1134 370
# Test declining in the incoming handler.
paul@1134 371
paul@1134 372
  "$PERSON_SCRIPT" $ARGS < out9.tmp 2>> $ERROR \
paul@1134 373
| "$SHOWMAIL" \
paul@1134 374
> out10.tmp
paul@1134 375
paul@1134 376
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1134 377
>  out10f.tmp
paul@1134 378
paul@1134 379
   [ `grep "event26@example.com" "out10f.tmp" | wc -l` = '2' ] \
paul@1134 380
&& grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out10f.tmp" \
paul@1134 381
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out10f.tmp" \
paul@1134 382
&& echo "Success" \
paul@1134 383
|| echo "Failed"
paul@1134 384
paul@1134 385
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER2" \
paul@1134 386
>  out10o.tmp
paul@1134 387
paul@1134 388
   [ `grep "event26@example.com" "out10o.tmp" | wc -l` = '1' ] \
paul@1134 389
&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out10o.tmp" \
paul@1134 390
&& grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out10o.tmp" \
paul@1134 391
&& echo "Success" \
paul@1134 392
|| echo "Failed"