imip-agent

tests/test_person_invitation_recurring.sh

1050:96f9567b0a99
2016-02-08 Paul Boddie With quotas, reject indefinitely recurring events, allowing rule-based events.
     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     15 mkdir -p "$PREFS/$SENDER"    16 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    17     18 # Test free/busy responses.    19     20   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \    21 | "$SHOWMAIL" \    22 > out0.tmp    23     24    grep -q 'METHOD:REPLY' out0.tmp \    25 && ! grep -q '^FREEBUSY' out0.tmp \    26 && echo "Success" \    27 || echo "Failed"    28     29   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \    30 | "$SHOWMAIL" \    31 > out1.tmp    32     33    grep -q 'METHOD:REPLY' out1.tmp \    34 && ! grep -q '^FREEBUSY' out1.tmp \    35 && echo "Success" \    36 || echo "Failed"    37     38 # Publish an event, testing registration in the outgoing handler.    39     40 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR    41     42    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \    43 && echo "Success" \    44 || echo "Failed"    45     46 # Test registration in the incoming handler for the recipient.    47     48   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \    49 | "$SHOWMAIL" \    50 > out2.tmp    51     52    ! grep -q 'METHOD:REPLY' out2.tmp \    53 && echo "Success" \    54 || echo "Failed"    55     56    ! [ -e "$FBFILE" ] \    57 || ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    58 && echo "Success" \    59 || echo "Failed"    60     61    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \    62 && echo "Success" \    63 || echo "Failed"    64     65 # Test acceptance and registration in the outgoing handler.    66     67   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \    68 | tee out3.tmp \    69 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR    70     71    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    72 && echo "Success" \    73 || echo "Failed"    74     75 # Test recurrence cancellation in the outgoing handler.    76     77 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR    78     79    [ `grep "event8@example.com" "$FBSENDERFILE" | wc -l` = '2' ] \    80 && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBSENDERFILE" \    81 && echo "Success" \    82 || echo "Failed"    83     84 # Test cancellation in the incoming handler.    85     86   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-instance.txt" 2>> $ERROR \    87 | "$SHOWMAIL" \    88 > out4.tmp    89     90    ! grep -q 'METHOD:REPLY' out4.tmp \    91 && echo "Success" \    92 || echo "Failed"    93     94    [ `grep "event8@example.com" "$FBFILE" | wc -l` = '2' ] \    95 && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBFILE" \    96 && echo "Success" \    97 || echo "Failed"    98     99    [ `grep "event8@example.com" "$FBOTHERFILE" | wc -l` = '2' ] \   100 && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBOTHERFILE" \   101 && echo "Success" \   102 || echo "Failed"   103    104 # Test rescheduling in the outgoing handler.   105    106 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR   107    108    grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \   109 && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \   110 && echo "Success" \   111 || echo "Failed"   112    113 # Test rescheduling in the incoming handler.   114    115   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR \   116 | "$SHOWMAIL" \   117 > out5.tmp   118    119    ! grep -q 'METHOD:REPLY' out5.tmp \   120 && echo "Success" \   121 || echo "Failed"   122    123    ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \   124 && grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \   125 && echo "Success" \   126 || echo "Failed"   127    128    grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBOTHERFILE" \   129 && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBOTHERFILE" \   130 && echo "Success" \   131 || echo "Failed"   132    133 # Test rescheduling acceptance in the outgoing handler.   134    135   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \   136 | tee out6.tmp \   137 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   138    139    grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \   140 && ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \   141 && echo "Success" \   142 || echo "Failed"   143    144 # Test complete cancellation in the outgoing handler.   145    146 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR   147    148    ! grep -q "event8@example.com" "$FBSENDERFILE" \   149 && echo "Success" \   150 || echo "Failed"   151    152 # Test complete cancellation in the incoming handler.   153    154   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \   155 | "$SHOWMAIL" \   156 > out6.tmp   157    158    ! grep -q 'METHOD:REPLY' out6.tmp \   159 && echo "Success" \   160 || echo "Failed"   161    162    ! grep -q "event8@example.com" "$FBFILE" \   163 && echo "Success" \   164 || echo "Failed"   165    166    ! grep -q "event8@example.com" "$FBOTHERFILE" \   167 && echo "Success" \   168 || echo "Failed"   169    170 # Switch time zones.   171    172 echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID"   173    174 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR   175    176    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \   177 && echo "Success" \   178 || echo "Failed"   179    180   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \   181 | "$SHOWMAIL" \   182 > out7.tmp   183    184    ! grep -q 'METHOD:REPLY' out7.tmp \   185 && echo "Success" \   186 || echo "Failed"   187    188    ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \   189 && echo "Success" \   190 || echo "Failed"   191    192    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \   193 && echo "Success" \   194 || echo "Failed"   195    196   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \   197 | tee out8.tmp \   198 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   199    200    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \   201 && echo "Success" \   202 || echo "Failed"   203    204 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR   205    206    ! grep -q "event8@example.com" "$FBSENDERFILE" \   207 && echo "Success" \   208 || echo "Failed"   209    210   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring.txt" 2>> $ERROR \   211 | "$SHOWMAIL" \   212 > out9.tmp   213    214    ! grep -q 'METHOD:REPLY' out9.tmp \   215 && echo "Success" \   216 || echo "Failed"   217    218    ! grep -q "event8@example.com" "$FBFILE" \   219 && echo "Success" \   220 || echo "Failed"   221    222    ! grep -q "event8@example.com" "$FBOTHERFILE" \   223 && echo "Success" \   224 || echo "Failed"   225    226 # Test floating dates. Here, the outgoing interpretation is different because   227 # the sender is in a different time zone.   228    229 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR   230    231    grep -q "^20141211T230000Z${TAB}20141212T230000Z" "$FBSENDERFILE" \   232 && echo "Success" \   233 || echo "Failed"   234    235   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-day-floating.txt" 2>> $ERROR \   236 | "$SHOWMAIL" \   237 > out10.tmp   238    239    ! grep -q 'METHOD:REPLY' out10.tmp \   240 && echo "Success" \   241 || echo "Failed"   242    243    ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBFILE" \   244 && echo "Success" \   245 || echo "Failed"   246    247 # (The organiser is not attending.)   248    249    ! grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBOTHERFILE" \   250 && echo "Success" \   251 || echo "Failed"   252    253   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event12@example.com" 2>> $ERROR \   254 | tee out11.tmp \   255 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   256    257    grep -q "^20141211T220000Z${TAB}20141212T220000Z" "$FBFILE" \   258 && echo "Success" \   259 || echo "Failed"