imip-agent

tests/test_person_invitation_add.sh

735:604e911427a4
2015-09-13 Paul Boddie Renamed a template file to conform to the naming scheme.
     1 #!/bin/sh     2      3 THIS_DIR=`dirname $0`     4      5 TEMPLATES="$THIS_DIR/templates"     6 PERSON_SCRIPT="$THIS_DIR/../imip_person.py"     7 SHOWMAIL="$THIS_DIR/../tools/showmail.py"     8 STORE=/tmp/store     9 STATIC=/tmp/static    10 PREFS=/tmp/prefs    11 ARGS="-S $STORE -P $STATIC -p $PREFS -d"    12 USER="mailto:vincent.vole@example.com"    13 SENDER="mailto:paul.boddie@example.com"    14 FBFILE="$STORE/$USER/freebusy"    15 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"    16 FBSENDERFILE="$STORE/$SENDER/freebusy"    17 FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"    18 TAB=`printf '\t'`    19     20 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"    21     22 PYTHONPATH="$THIS_DIR/.."    23 export PYTHONPATH    24     25 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"    26 ACCEPT_ARGS="accept $STORE"    27     28 DECLINE_SCRIPT="$THIS_DIR/test_handle.py"    29 DECLINE_ARGS="decline $STORE"    30     31 ERROR=err.tmp    32     33 rm -r $STORE    34 rm -r $STATIC    35 rm -r $PREFS    36 rm $ERROR    37 rm out*.tmp    38     39 mkdir -p "$PREFS/$USER"    40 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    41 echo 'share' > "$PREFS/$USER/freebusy_sharing"    42     43 mkdir -p "$PREFS/$SENDER"    44 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    45 echo 'always' > "$PREFS/$SENDER/event_refreshing"    46     47 # Test event request registration in the outgoing handler.    48     49 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR    50     51    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \    52 && echo "Success" \    53 || echo "Failed"    54     55 # Present the request to the recipient.    56     57   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \    58 | "$SHOWMAIL" \    59 > out2.tmp    60     61    ! grep -q 'METHOD:REPLY' out2.tmp \    62 && echo "Success" \    63 || echo "Failed"    64     65    ! [ -e "$FBFILE" ] \    66 || ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    67 && echo "Success" \    68 || echo "Failed"    69     70    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \    71 && echo "Success" \    72 || echo "Failed"    73     74 # Test acceptance and registration in the outgoing handler.    75     76   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \    77 | tee out3.tmp \    78 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR    79     80    "$SHOWMAIL" < out3.tmp | grep -q 'METHOD:REPLY' \    81 && echo "Success" \    82 || echo "Failed"    83     84    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \    85 && echo "Success" \    86 || echo "Failed"    87     88 # Present the result to the recipient.    89     90   "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \    91 | "$SHOWMAIL" \    92 > out4.tmp    93     94    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \    95 && echo "Success" \    96 || echo "Failed"    97     98 # Attempt to add an occurrence to the event.    99    100 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR   101    102    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \   103 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDERFILE" \   104 && echo "Success" \   105 || echo "Failed"   106    107 # Present the request to the recipient.   108    109   "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR \   110 | "$SHOWMAIL" \   111 > out5.tmp   112    113    grep -q 'METHOD:REFRESH' out5.tmp \   114 && echo "Success" \   115 || echo "Failed"   116    117    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \   118 && ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \   119 && echo "Success" \   120 || echo "Failed"   121    122    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \   123 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBOTHERFILE" \   124 && echo "Success" \   125 || echo "Failed"   126    127 # Present the refresh message to the organiser.   128    129   "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \   130 | "$SHOWMAIL" \   131 > out6.tmp   132    133    grep -q 'METHOD:REQUEST' out6.tmp \   134 && echo "Success" \   135 || echo "Failed"   136    137 # Present the request to the recipient.   138    139   "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \   140 | "$SHOWMAIL" \   141 > out7.tmp   142    143    ! grep -q 'METHOD:REPLY' out7.tmp \   144 && echo "Success" \   145 || echo "Failed"   146    147    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \   148 && ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \   149 && echo "Success" \   150 || echo "Failed"   151    152    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \   153 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBOTHERFILE" \   154 && echo "Success" \   155 || echo "Failed"   156    157 # Test acceptance and registration in the outgoing handler.   158    159   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \   160 | tee out8.tmp \   161 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   162    163    "$SHOWMAIL" < out8.tmp | grep -q 'METHOD:REPLY' \   164 && echo "Success" \   165 || echo "Failed"   166    167   "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20150109T090000Z" 2>> $ERROR \   168 | tee out9.tmp \   169 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   170    171    "$SHOWMAIL" < out9.tmp | grep -q 'METHOD:REPLY' \   172 && echo "Success" \   173 || echo "Failed"   174    175    grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \   176 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \   177 && echo "Success" \   178 || echo "Failed"