imip-agent

tests/test_resource_invitation_constraints_alternative.sh

789:c90e7281106d
2015-09-29 Paul Boddie Added missing escaping for text within elements.
     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 -r $STORE    29 rm -r $STATIC    30 rm -r $PREFS    31 rm $ERROR    32 rm out*.tmp    33     34 mkdir -p "$PREFS/$USER"    35 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    36 echo 'share' > "$PREFS/$USER/freebusy_sharing"    37 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"    38 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    39     40   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    41 | "$SHOWMAIL" \    42 > out0.tmp    43     44    grep -q 'METHOD:REPLY' out0.tmp \    45 && ! grep -q '^FREEBUSY' out0.tmp \    46 && echo "Success" \    47 || echo "Failed"    48     49 # Attempt to schedule an event.    50     51 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR    52     53    grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDERFILE" \    54 && echo "Success" \    55 || echo "Failed"    56     57 # Present the request to the resource.    58     59   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \    60 | "$SHOWMAIL" \    61 > out1.tmp    62     63    grep -q 'METHOD:COUNTER' out1.tmp \    64 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \    65 && echo "Success" \    66 || echo "Failed"    67     68    ! [ -e "$FBFILE" ] \    69 || ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBFILE" \    70 && echo "Success" \    71 || echo "Failed"    72     73    grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBOFFERFILE" \    74 && echo "Success" \    75 || echo "Failed"    76     77 # Present the response to the organiser.    78     79   "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \    80 | tee out2r.tmp \    81 | "$SHOWMAIL" \    82 > out2.tmp    83     84    [ ! -e "$FBSENDEROTHERFILE" ] \    85 || ( ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" \    86   && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "$FBSENDEROTHERFILE" ) \    87 && echo "Success" \    88 || echo "Failed"    89     90    grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' "$STORE/$SENDER/objects/event13@example.com" \    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"