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 ARGS="-S $STORE -P $STATIC -d" 11 USER="mailto:vincent.vole@example.com" 12 SENDER="mailto:paul.boddie@example.com" 13 FBFILE="$STORE/$USER/freebusy" 14 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" 15 TAB=`printf '\t'` 16 17 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py" 18 19 PYTHONPATH="$THIS_DIR/.." 20 export PYTHONPATH 21 22 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" 23 ACCEPT_ARGS="accept $STORE" 24 25 DECLINE_SCRIPT="$THIS_DIR/test_handle.py" 26 DECLINE_ARGS="decline $STORE" 27 28 rm -r $STORE 29 rm -r $STATIC 30 31 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2> /dev/null \ 32 | "$SHOWMAIL" \ 33 > out0.tmp 34 35 grep -q 'METHOD:REPLY' out0.tmp \ 36 && ! grep -q '^FREEBUSY' out0.tmp \ 37 && echo "Success" \ 38 || echo "Failed" 39 40 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2> /dev/null \ 41 | "$SHOWMAIL" \ 42 > out1.tmp 43 44 grep -q 'METHOD:REPLY' out1.tmp \ 45 && ! grep -q '^FREEBUSY' out1.tmp \ 46 && echo "Success" \ 47 || echo "Failed" 48 49 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2> /dev/null \ 50 | "$SHOWMAIL" \ 51 > out2.tmp 52 53 ! grep -q 'METHOD:REPLY' out2.tmp \ 54 && echo "Success" \ 55 || echo "Failed" 56 57 ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 58 && echo "Success" \ 59 || echo "Failed" 60 61 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBOTHERFILE" \ 62 && echo "Success" \ 63 || echo "Failed" 64 65 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event6@example.com" \ 66 | tee out3.tmp \ 67 | "$OUTGOING_SCRIPT" $ARGS 68 69 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 70 && echo "Success" \ 71 || echo "Failed" 72 73 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-conflict.txt" 2> /dev/null \ 74 | "$SHOWMAIL" \ 75 > out4.tmp 76 77 ! grep -q 'METHOD:REPLY' out4.tmp \ 78 && echo "Success" \ 79 || echo "Failed" 80 81 ! grep -q "event7@example.com" "$FBFILE" \ 82 && echo "Success" \ 83 || echo "Failed" 84 85 grep -q "event7@example.com" "$FBOTHERFILE" \ 86 && echo "Success" \ 87 || echo "Failed" 88 89 "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER" "event7@example.com" \ 90 | tee out5.tmp \ 91 | "$OUTGOING_SCRIPT" $ARGS 92 93 grep -q "event6@example.com" "$FBFILE" \ 94 && ! grep -q "event7@example.com" "$FBFILE" \ 95 && echo "Success" \ 96 || echo "Failed"