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 TAB=`printf '\t'` 17 18 OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py" 19 20 PYTHONPATH="$THIS_DIR/.." 21 export PYTHONPATH 22 23 ACCEPT_SCRIPT="$THIS_DIR/test_handle.py" 24 ACCEPT_ARGS="accept $STORE" 25 26 DECLINE_SCRIPT="$THIS_DIR/test_handle.py" 27 DECLINE_ARGS="decline $STORE" 28 29 ERROR=err.tmp 30 31 rm -r $STORE 32 rm -r $STATIC 33 rm -r $PREFS 34 rm $ERROR 35 rm out*.tmp 36 37 mkdir -p "$PREFS/$USER" 38 echo 'Europe/Oslo' > "$PREFS/$USER/TZID" 39 echo 'share' > "$PREFS/$USER/freebusy_sharing" 40 41 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-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 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \ 51 | "$SHOWMAIL" \ 52 > out1.tmp 53 54 grep -q 'METHOD:REPLY' out1.tmp \ 55 && ! grep -q '^FREEBUSY' out1.tmp \ 56 && echo "Success" \ 57 || echo "Failed" 58 59 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \ 60 | "$SHOWMAIL" \ 61 > out2.tmp 62 63 ! grep -q 'METHOD:REPLY' out2.tmp \ 64 && echo "Success" \ 65 || echo "Failed" 66 67 ! [ -e "$FBFILE" ] \ 68 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 69 && echo "Success" \ 70 || echo "Failed" 71 72 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBOTHERFILE" \ 73 && echo "Success" \ 74 || echo "Failed" 75 76 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event6@example.com" 2>> $ERROR \ 77 | tee out3.tmp \ 78 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 79 80 grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 81 && echo "Success" \ 82 || echo "Failed" 83 84 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-conflict.txt" 2>> $ERROR \ 85 | "$SHOWMAIL" \ 86 > out4.tmp 87 88 ! grep -q 'METHOD:REPLY' out4.tmp \ 89 && echo "Success" \ 90 || echo "Failed" 91 92 ! grep -q "event7@example.com" "$FBFILE" \ 93 && echo "Success" \ 94 || echo "Failed" 95 96 grep -q "event7@example.com" "$FBOTHERFILE" \ 97 && echo "Success" \ 98 || echo "Failed" 99 100 "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER" "event7@example.com" 2>> $ERROR \ 101 | tee out5.tmp \ 102 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 103 104 grep -q "event6@example.com" "$FBFILE" \ 105 && ! grep -q "event7@example.com" "$FBFILE" \ 106 && echo "Success" \ 107 || echo "Failed" 108 109 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person.txt" 2>> $ERROR \ 110 | "$SHOWMAIL" \ 111 > out6.tmp 112 113 ! grep -q 'METHOD:REPLY' out6.tmp \ 114 && echo "Success" \ 115 || echo "Failed" 116 117 ! grep -q "event6@example.com" "$FBFILE" \ 118 && echo "Success" \ 119 || echo "Failed" 120 121 grep -q "event6@example.com" "$FBOTHERFILE" \ 122 && echo "Success" \ 123 || echo "Failed" 124 125 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-all.txt" 2>> $ERROR \ 126 | "$SHOWMAIL" \ 127 > out7.tmp 128 129 ! grep -q 'METHOD:REPLY' out7.tmp \ 130 && echo "Success" \ 131 || echo "Failed" 132 133 ! grep -q "event6@example.com" "$FBFILE" \ 134 && echo "Success" \ 135 || echo "Failed" 136 137 ! grep -q "event6@example.com" "$FBOTHERFILE" \ 138 && echo "Success" \ 139 || echo "Failed" 140 141 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-spoofed.txt" 2>> $ERROR \ 142 | "$SHOWMAIL" \ 143 > out8.tmp 144 145 ! grep -q 'METHOD:REPLY' out8.tmp \ 146 && echo "Success" \ 147 || echo "Failed" 148 149 ! grep -q "spoof2@example.com" "$FBFILE" \ 150 && echo "Success" \ 151 || echo "Failed" 152 153 ! grep -q "spoof2@example.com" "$FBOTHERFILE" \ 154 && echo "Success" \ 155 || echo "Failed"