imip-agent

tests/test_person_invitation_counter.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 FBOFFERFILE="$STORE/$USER/freebusy-offers"     9 FBSENDERFILE="$STORE/$SENDER/freebusy"    10 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"    11 FBSENDERREQUESTS="$STORE/$SENDER/requests"    12     13 mkdir -p "$PREFS/$USER"    14 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    15 echo 'share' > "$PREFS/$USER/freebusy_sharing"    16 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    17     18   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \    19 | "$SHOWMAIL" \    20 > out0.tmp    21     22    grep -q 'METHOD:REPLY' out0.tmp \    23 && ! grep -q '^FREEBUSY' out0.tmp \    24 && echo "Success" \    25 || echo "Failed"    26     27 # Attempt to schedule an event.    28     29 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR    30     31    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDERFILE" \    32 && echo "Success" \    33 || echo "Failed"    34     35 # Present the request to the recipient.    36     37   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \    38 | "$SHOWMAIL" \    39 > out1.tmp    40     41    ! grep -q 'METHOD:REPLY' out1.tmp \    42 && echo "Success" \    43 || echo "Failed"    44     45    ! [ -e "$FBFILE" ] \    46 || ! grep -q "event6@example.com" "$FBFILE" \    47 && echo "Success" \    48 || echo "Failed"    49     50    ! [ -e "$FBOTHERFILE" ] \    51 || ! grep -q "event6@example.com" "$FBOTHERFILE" \    52 && echo "Success" \    53 || echo "Failed"    54     55 # Counter the invitation.    56     57   "$COUNTER_SCRIPT" $COUNTER_ARGS "$USER" 20141126T170000 20141126T180000 "event6@example.com" 2>> $ERROR \    58 | tee out2r.tmp \    59 | "$SHOWMAIL" \    60 > out2.tmp    61     62 # Note that the invitation has only been prepared, not processed.    63     64    ! [ -e "$FBFILE" ] \    65 || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \    66   && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBFILE" ) \    67 && echo "Success" \    68 || echo "Failed"    69     70    grep -q 'METHOD:COUNTER' out2.tmp \    71 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' out2.tmp \    72 && echo "Success" \    73 || echo "Failed"    74     75    ! [ -e "$FBOFFERFILE" ] \    76 || ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBOFFERFILE" \    77 && echo "Success" \    78 || echo "Failed"    79     80 # Send the counter-proposal.    81     82 "$OUTGOING_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR    83     84    ! [ -e "$FBFILE" ] \    85 || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \    86   && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBFILE" ) \    87 && echo "Success" \    88 || echo "Failed"    89     90    grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBOFFERFILE" \    91 && echo "Success" \    92 || echo "Failed"    93     94 # Present the response to the organiser.    95     96   "$PERSON_SCRIPT" $ARGS < out2r.tmp 2>> $ERROR \    97 | tee out3r.tmp \    98 | "$SHOWMAIL" \    99 > out3.tmp   100    101    ! [ -e "$FBSENDEROTHERFILE" ] \   102 || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBSENDEROTHERFILE" \   103   && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBSENDEROTHERFILE" ) \   104 && echo "Success" \   105 || echo "Failed"   106    107    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T160000' "$STORE/$SENDER/objects/event6@example.com" \   108 && echo "Success" \   109 || echo "Failed"   110    111    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T170000' "$STORE/$SENDER/counters/objects/event6@example.com/$USER" \   112 && echo "Success" \   113 || echo "Failed"   114    115    grep -q 'event6@example.com' "$FBSENDERREQUESTS" \   116 && echo "Success" \   117 || echo "Failed"   118    119 # Check the free/busy state of the recipient so far.   120    121   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \   122 | "$SHOWMAIL" \   123 > out4.tmp   124    125    grep -q 'METHOD:REPLY' out4.tmp \   126 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out4.tmp \   127 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T160000Z/20141126T170000Z' out4.tmp \   128 && echo "Success" \   129 || echo "Failed"   130    131 # Decline the counter-proposal.   132    133   sed 's/COUNTER/DECLINECOUNTER/' < out2.tmp \   134 | sed 's/^From: calendar/To: vincent.vole/' \   135 | sed 's/^To: paul.boddie/From: paul.boddie/' \   136 > out5.tmp   137    138 "$OUTGOING_SCRIPT" $ARGS < out5.tmp 2>> $ERROR   139    140    ! [ -e "$STORE/$SENDER/counters/objects/event6@example.com/$USER" ] \   141 && echo "Success" \   142 || echo "Failed"   143    144    ! grep -q 'event6@example.com' "$FBSENDERREQUESTS" \   145 && echo "Success" \   146 || echo "Failed"   147    148   "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \   149 | "$SHOWMAIL" \   150 > out6.tmp   151    152    ! [ -e "$FBFILE" ] \   153 || ( ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \   154   && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBFILE" ) \   155 && echo "Success" \   156 || echo "Failed"   157    158    ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBOFFERFILE" \   159 && ! grep -q "^20141126T160000Z${TAB}20141126T170000Z" "$FBOFFERFILE" \   160 && echo "Success" \   161 || echo "Failed"