imip-agent

tests/test_person_invitation_decline_instance.sh

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