imip-agent

tests/test_resource_invitation_constraints_alternative.sh

1023:8fff9da40e5d
2016-01-29 Paul Boddie Fixed translated message for unshared events.
     1 #!/bin/sh     2      3 THIS_DIR=`dirname $0`     4      5 TEMPLATES="$THIS_DIR/templates"     6 PERSON_SCRIPT="$THIS_DIR/../imip_person.py"     7 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"     8 SHOWMAIL="$THIS_DIR/../tools/showmail.py"     9 STORE=/tmp/store    10 STATIC=/tmp/static    11 PREFS=/tmp/prefs    12 ARGS="-S $STORE -P $STATIC -p $PREFS -d"    13 USER="mailto:resource-room-sauna@example.com"    14 SENDER="mailto:paul.boddie@example.com"    15 RIVALSENDER="mailto:vincent.vole@example.com"    16 FBFILE="$STORE/$USER/freebusy"    17 FBOFFERFILE="$STORE/$USER/freebusy-offers"    18 FBSENDERFILE="$STORE/$SENDER/freebusy"    19 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"    20 FBSENDERREQUESTS="$STORE/$SENDER/requests"    21 FBRIVALSENDERFILE="$STORE/$RIVALSENDER/freebusy"    22 TAB=`printf '\t'`    23     24 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"    25     26 ERROR=err.tmp    27     28 rm -rf $STORE    29 rm -rf $STATIC    30 rm -rf $PREFS    31 rm -f $ERROR    32 rm -f out*.tmp    33     34 mkdir -p "$PREFS/$USER"    35 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    36 echo 'share' > "$PREFS/$USER/freebusy_sharing"    37 echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"    38 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"    39 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    40     41   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    42 | "$SHOWMAIL" \    43 > out0.tmp    44     45    grep -q 'METHOD:REPLY' out0.tmp \    46 && ! grep -q '^FREEBUSY' out0.tmp \    47 && echo "Success" \    48 || echo "Failed"    49     50 # Attempt to schedule an event.    51     52 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR    53     54    grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \    55 && echo "Success" \    56 || echo "Failed"    57     58 # Present the request to the resource.    59     60   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \    61 | "$SHOWMAIL" \    62 > out1.tmp    63     64    grep -q 'METHOD:COUNTER' out1.tmp \    65 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \    66 && echo "Success" \    67 || echo "Failed"    68     69    ! [ -e "$FBFILE" ] \    70 || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \    71 && echo "Success" \    72 || echo "Failed"    73     74    grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \    75 && echo "Success" \    76 || echo "Failed"    77     78 # Present the response to the organiser.    79     80   "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \    81 | tee out2r.tmp \    82 | "$SHOWMAIL" \    83 > out2.tmp    84     85    [ ! -e "$FBSENDEROTHERFILE" ] \    86 || ( ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" \    87   && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" ) \    88 && echo "Success" \    89 || echo "Failed"    90     91    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' "$STORE/$SENDER/objects/event13@example.com" \    92 && echo "Success" \    93 || echo "Failed"    94     95    grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' "$STORE/$SENDER/counters/objects/event13@example.com/$USER" \    96 && echo "Success" \    97 || echo "Failed"    98     99    grep -q 'event13@example.com' "$FBSENDERREQUESTS" \   100 && echo "Success" \   101 || echo "Failed"   102    103 # Decline the counter-proposal.   104    105   sed 's/COUNTER/DECLINECOUNTER/' < out1.tmp \   106 | sed 's/^From: calendar/To: resource-room-sauna/' \   107 | sed 's/^To: paul.boddie/From: paul.boddie/' \   108 > out3.tmp   109    110 "$OUTGOING_SCRIPT" $ARGS < out3.tmp 2>> $ERROR   111    112   "$RESOURCE_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \   113 | "$SHOWMAIL" \   114 > out4.tmp   115    116    ! [ -e "$FBFILE" ] \   117 || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \   118 && echo "Success" \   119 || echo "Failed"   120    121    ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \   122 && echo "Success" \   123 || echo "Failed"   124    125 # Attempt to schedule an event in the proposed period.   126    127 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR   128    129    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   130 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   131 && echo "Success" \   132 || echo "Failed"   133    134 # Present the request to the resource.   135    136   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \   137 | "$SHOWMAIL" \   138 > out5.tmp   139    140    grep -q 'METHOD:REPLY' out5.tmp \   141 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out5.tmp \   142 && echo "Success" \   143 || echo "Failed"   144    145    grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBFILE" \   146 && echo "Success" \   147 || echo "Failed"   148    149    ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBOFFERFILE" \   150 && echo "Success" \   151 || echo "Failed"   152    153 # Present the response to the organiser.   154    155   "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \   156 | "$SHOWMAIL" \   157 > out6.tmp   158    159    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   160 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   161 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "$FBRIVALSENDERFILE" \   162 && echo "Success" \   163 || echo "Failed"   164    165    grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' "$STORE/$RIVALSENDER/objects/event18@example.com" \   166 && echo "Success" \   167 || echo "Failed"   168    169 # Check the free/busy state of the resource so far.   170    171   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   172 | "$SHOWMAIL" \   173 > out7.tmp   174    175    grep -q 'METHOD:REPLY' out7.tmp \   176 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out7.tmp \   177 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out7.tmp \   178 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out7.tmp \   179 && echo "Success" \   180 || echo "Failed"