imip-agent

tests/test_person_invitation_refresh.sh

1421:05de61cc499f
2017-12-12 Paul Boddie Made period classification use unedited rather than stored periods. client-editing-simplification
     1 #!/bin/sh     2      3 . "`dirname \"$0\"`/common.sh"     4      5 USER="mailto:vincent.vole@example.com"     6 SENDER="mailto:paul.boddie@example.com"     7      8 mkdir -p "$PREFS/$USER"     9 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    10 echo 'share' > "$PREFS/$USER/freebusy_sharing"    11 echo 'add' > "$PREFS/$USER/add_method_response"    12     13 mkdir -p "$PREFS/$SENDER"    14 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    15 echo 'always' > "$PREFS/$SENDER/event_refreshing"    16     17 # Publish an event, testing registration in the outgoing handler.    18     19 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR    20     21    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    22 >  out1f.tmp    23     24    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out1f.tmp" \    25 && echo "Success" \    26 || echo "Failed"    27     28 # Test a request from an attendee for the event details to be refreshed.    29     30   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \    31 | "$SHOWMAIL" \    32 > out2.tmp    33     34    grep -q 'METHOD:REQUEST' out2.tmp \    35 && echo "Success" \    36 || echo "Failed"    37     38 # Present the result to the recipient.    39     40   "$PERSON_SCRIPT" $ARGS < out2.tmp 2>> $ERROR \    41 | "$SHOWMAIL" \    42 > out3.tmp    43     44    ! grep -q 'METHOD:REPLY' out3.tmp \    45 && echo "Success" \    46 || echo "Failed"    47     48    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    49 >  out3f.tmp    50     51    ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \    52 && echo "Success" \    53 || echo "Failed"    54     55    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \    56 >  out3f.tmp    57     58    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \    59 && echo "Success" \    60 || echo "Failed"    61     62 # Test acceptance and registration in the outgoing handler.    63     64   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \    65 | tee out4.tmp \    66 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR    67     68    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    69 >  out4f.tmp    70     71    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out4f.tmp" \    72 && echo "Success" \    73 || echo "Failed"    74     75 # Test a request from a non-attendee for the event details to be refreshed.    76     77   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring-non-attendee.txt" 2>> $ERROR \    78 | "$SHOWMAIL" \    79 > out5.tmp    80     81    ! grep -q 'METHOD:REQUEST' out5.tmp \    82 && echo "Success" \    83 || echo "Failed"    84     85 # Test rescheduling in the outgoing handler.    86     87 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR    88     89    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    90 >  out5f.tmp    91     92    grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out5f.tmp" \    93 && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out5f.tmp" \    94 && echo "Success" \    95 || echo "Failed"    96     97 # Test another request from an attendee for the event details to be refreshed.    98     99   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \   100 | tee out6r.tmp \   101 | "$SHOWMAIL" \   102 > out6.tmp   103    104    grep -q 'METHOD:REQUEST' out6.tmp \   105 && grep -q 'RECURRENCE-ID' out6.tmp \   106 && [ `grep 'BEGIN:VEVENT' out6.tmp | wc -l` = '2' ] \   107 && echo "Success" \   108 || echo "Failed"   109    110 # Process the resulting message.   111    112   "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \   113 | "$SHOWMAIL" \   114 > out6a.tmp   115    116    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event8@example.com" \   117 >  out6O.tmp   118    119    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event8@example.com" "20141010T080000Z" \   120 >  out6R.tmp   121    122    grep -q 'event8@example.com' "out6O.tmp" \   123 && grep -q 'event8@example.com' "out6R.tmp" \   124 && echo "Success" \   125 || echo "Failed"   126    127 # Cancel a recurrence. Both the original and rescheduled recurrences should be   128 # absent from the free/busy collection.   129    130 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-rescheduled-instance.txt" 2>> $ERROR   131    132    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event8@example.com" \   133 >  out6O2.tmp   134    135    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "recurrence" "event8@example.com" "20141010T080000Z" \   136 >  out6R2.tmp   137    138    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "cancelled_recurrences" "event8@example.com" \   139 >  out6C.tmp   140    141    grep -q 'event8@example.com' "out6O2.tmp" \   142 && ! grep -q 'event8@example.com' "out6R2.tmp" \   143 && grep -q '20141010T080000Z' "out6C.tmp" \   144 && echo "Success" \   145 || echo "Failed"   146    147    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   148 >  out6f.tmp   149    150    ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out6f.tmp" \   151 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out6f.tmp" \   152 && echo "Success" \   153 || echo "Failed"   154    155 # Test another request from an attendee for the event details to be refreshed.   156 # The additional recurrence should now be absent.   157    158   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \   159 | tee out7r.tmp \   160 | "$SHOWMAIL" \   161 > out7.tmp   162    163    grep -q 'METHOD:REQUEST' out7.tmp \   164 && grep -q 'METHOD:CANCEL' out7.tmp \   165 && [ `grep 'BEGIN:VEVENT' out7.tmp | wc -l` = '2' ] \   166 && echo "Success" \   167 || echo "Failed"   168    169 # Process the resulting message.   170    171   "$PERSON_SCRIPT" $ARGS < out7r.tmp 2>> $ERROR \   172 | "$SHOWMAIL" \   173 > out7a.tmp   174    175    "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event8@example.com" \   176 >  out7O.tmp   177    178    "$LIST_SCRIPT" $LIST_ARGS "$USER" "recurrence" "event8@example.com" "20141010T080000Z" \   179 >  out7R.tmp   180    181    "$LIST_SCRIPT" $LIST_ARGS "$USER" "cancelled_recurrences" "event8@example.com" \   182 >  out7C.tmp   183    184    grep -q 'event8@example.com' "out7O.tmp" \   185 && ! grep -q 'event8@example.com' "out7R.tmp" \   186 && grep -q '20141010T080000Z' "out7C.tmp" \   187 && echo "Success" \   188 || echo "Failed"   189    190 # Re-add the cancelled instance.   191    192 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR   193    194    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   195 >  out7f.tmp   196    197    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out7f.tmp" \   198 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "out7f.tmp" \   199 && echo "Success" \   200 || echo "Failed"   201    202   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR \   203 | "$SHOWMAIL" \   204 > out8.tmp   205    206    "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event8@example.com" \   207 >  out8O.tmp   208    209    "$LIST_SCRIPT" $LIST_ARGS "$USER" "recurrence" "event8@example.com" "20141010T080000Z" \   210 >  out8R.tmp   211    212    "$LIST_SCRIPT" $LIST_ARGS "$USER" "cancelled_recurrences" "event8@example.com" \   213 >  out8C.tmp   214    215    grep -q 'event8@example.com' "out8O.tmp" \   216 && grep -q 'event8@example.com' "out8R.tmp" \   217 && ! grep -q '20141010T080000Z' "out8C.tmp" \   218 && echo "Success" \   219 || echo "Failed"   220    221    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   222 >  out8f.tmp   223    224    ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out8f.tmp" \   225 && echo "Success" \   226 || echo "Failed"   227    228    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \   229 >  out8f.tmp   230    231    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out8f.tmp" \   232 && echo "Success" \   233 || echo "Failed"   234    235 # Test acceptance and registration in the outgoing handler.   236    237   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \   238 | tee out9.tmp \   239 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   240    241    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   242 >  out9f.tmp   243    244    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "out9f.tmp" \   245 && echo "Success" \   246 || echo "Failed"   247    248 # Test yet another request from an attendee for the event details to be refreshed.   249    250   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \   251 | tee out10r.tmp \   252 | "$SHOWMAIL" \   253 > out10.tmp   254    255    grep -q 'METHOD:REQUEST' out10.tmp \   256 && grep -q 'RECURRENCE-ID' out10.tmp \   257 && [ `grep 'BEGIN:VEVENT' out10.tmp | wc -l` = '2' ] \   258 && echo "Success" \   259 || echo "Failed"   260    261 # Process the resulting message.   262    263   "$PERSON_SCRIPT" $ARGS < out10r.tmp 2>> $ERROR \   264 | "$SHOWMAIL" \   265 > out11.tmp   266    267    "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event8@example.com" \   268 >  out11O.tmp   269    270    "$LIST_SCRIPT" $LIST_ARGS "$USER" "recurrence" "event8@example.com" "20141010T080000Z" \   271 >  out11R.tmp   272    273    grep -q 'event8@example.com' "out11O.tmp" \   274 && grep -q 'event8@example.com' "out11R.tmp" \   275 && echo "Success" \   276 || echo "Failed"