imip-agent

tests/test_person_invitation_refresh.sh

1069:37921ab84c01
2016-03-06 Paul Boddie Moved imip_store into a new imiptools.stores package as the file module.
     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 FBFILE="$STORE/$USER/freebusy"     8 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"     9 FBSENDERFILE="$STORE/$SENDER/freebusy"    10     11 mkdir -p "$PREFS/$USER"    12 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    13 echo 'share' > "$PREFS/$USER/freebusy_sharing"    14 echo 'add' > "$PREFS/$USER/add_method_response"    15     16 mkdir -p "$PREFS/$SENDER"    17 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    18 echo 'always' > "$PREFS/$SENDER/event_refreshing"    19     20 # Publish an event, testing registration in the outgoing handler.    21     22 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR    23     24    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \    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    ! [ -e "$FBFILE" ] \    49 || ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    50 && echo "Success" \    51 || echo "Failed"    52     53    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \    54 && echo "Success" \    55 || echo "Failed"    56     57 # Test acceptance and registration in the outgoing handler.    58     59   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \    60 | tee out4.tmp \    61 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR    62     63    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    64 && echo "Success" \    65 || echo "Failed"    66     67 # Test a request from a non-attendee for the event details to be refreshed.    68     69   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring-non-attendee.txt" 2>> $ERROR \    70 | "$SHOWMAIL" \    71 > out5.tmp    72     73    ! grep -q 'METHOD:REQUEST' out5.tmp \    74 && echo "Success" \    75 || echo "Failed"    76     77 # Test rescheduling in the outgoing handler.    78     79 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR    80     81    grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \    82 && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \    83 && echo "Success" \    84 || echo "Failed"    85     86 # Test another request from an attendee for the event details to be refreshed.    87     88   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \    89 | tee out6r.tmp \    90 | "$SHOWMAIL" \    91 > out6.tmp    92     93    grep -q 'METHOD:REQUEST' out6.tmp \    94 && grep -q 'RECURRENCE-ID' out6.tmp \    95 && [ `grep 'BEGIN:VEVENT' out6.tmp | wc -l` = '2' ] \    96 && echo "Success" \    97 || echo "Failed"    98     99 # Process the resulting message.   100    101   "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \   102 | "$SHOWMAIL" \   103 > out6a.tmp   104    105    [ -e "$STORE/$USER/objects/event8@example.com" ] \   106 && [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \   107 && echo "Success" \   108 || echo "Failed"   109    110 # Cancel a recurrence. Both the original and rescheduled recurrences should be   111 # absent from the free/busy collection.   112    113 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-rescheduled-instance.txt" 2>> $ERROR   114    115    [ -e "$STORE/$SENDER/objects/event8@example.com" ] \   116 && ! [ -e "$STORE/$SENDER/recurrences/event8@example.com/20141010T080000Z" ] \   117 && [ -e "$STORE/$SENDER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \   118 && echo "Success" \   119 || echo "Failed"   120    121    ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \   122 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \   123 && echo "Success" \   124 || echo "Failed"   125    126 # Test another request from an attendee for the event details to be refreshed.   127 # The additional recurrence should now be absent.   128    129   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \   130 | tee out7r.tmp \   131 | "$SHOWMAIL" \   132 > out7.tmp   133    134    grep -q 'METHOD:REQUEST' out7.tmp \   135 && grep -q 'METHOD:CANCEL' out7.tmp \   136 && [ `grep 'BEGIN:VEVENT' out7.tmp | wc -l` = '2' ] \   137 && echo "Success" \   138 || echo "Failed"   139    140 # Process the resulting message.   141    142   "$PERSON_SCRIPT" $ARGS < out7r.tmp 2>> $ERROR \   143 | "$SHOWMAIL" \   144 > out7a.tmp   145    146    [ -e "$STORE/$USER/objects/event8@example.com" ] \   147 && ! [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \   148 && [ -e "$STORE/$USER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \   149 && echo "Success" \   150 || echo "Failed"   151    152 # Re-add the cancelled instance.   153    154 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR   155    156    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \   157 && ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \   158 && echo "Success" \   159 || echo "Failed"   160    161   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR \   162 | "$SHOWMAIL" \   163 > out8.tmp   164    165    [ -e "$STORE/$USER/objects/event8@example.com" ] \   166 && [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \   167 && ! [ -e "$STORE/$USER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \   168 && echo "Success" \   169 || echo "Failed"   170    171    ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \   172 && echo "Success" \   173 || echo "Failed"   174    175    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBOTHERFILE" \   176 && echo "Success" \   177 || echo "Failed"   178    179 # Test acceptance and registration in the outgoing handler.   180    181   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \   182 | tee out9.tmp \   183 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   184    185    grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \   186 && echo "Success" \   187 || echo "Failed"   188    189 # Test yet another request from an attendee for the event details to be refreshed.   190    191   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \   192 | tee out10r.tmp \   193 | "$SHOWMAIL" \   194 > out10.tmp   195    196    grep -q 'METHOD:REQUEST' out10.tmp \   197 && grep -q 'RECURRENCE-ID' out10.tmp \   198 && [ `grep 'BEGIN:VEVENT' out10.tmp | wc -l` = '2' ] \   199 && echo "Success" \   200 || echo "Failed"   201    202 # Process the resulting message.   203    204   "$PERSON_SCRIPT" $ARGS < out10r.tmp 2>> $ERROR \   205 | "$SHOWMAIL" \   206 > out11.tmp   207    208    [ -e "$STORE/$USER/objects/event8@example.com" ] \   209 && [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \   210 && echo "Success" \   211 || echo "Failed"