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 $PREFS" 27 28 DECLINE_SCRIPT="$THIS_DIR/test_handle.py" 29 DECLINE_ARGS="decline $STORE $PREFS" 30 31 ERROR=err.tmp 32 33 rm -rf $STORE 34 rm -rf $STATIC 35 rm -rf $PREFS 36 rm -f $ERROR 37 rm -f 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 | tee out6r.tmp \ 131 | "$SHOWMAIL" \ 132 > out6.tmp 133 134 grep -q 'METHOD:REQUEST' out6.tmp \ 135 && echo "Success" \ 136 || echo "Failed" 137 138 # Present the request to the recipient. 139 140 "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \ 141 | "$SHOWMAIL" \ 142 > out7.tmp 143 144 ! grep -q 'METHOD:REPLY' out7.tmp \ 145 && echo "Success" \ 146 || echo "Failed" 147 148 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ 149 && ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \ 150 && echo "Success" \ 151 || echo "Failed" 152 153 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \ 154 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBOTHERFILE" \ 155 && echo "Success" \ 156 || echo "Failed" 157 158 # Test acceptance and registration in the outgoing handler. 159 160 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \ 161 | tee out8.tmp \ 162 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 163 164 "$SHOWMAIL" < out8.tmp | grep -q 'METHOD:REPLY' \ 165 && echo "Success" \ 166 || echo "Failed" 167 168 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20150109T090000Z" 2>> $ERROR \ 169 | tee out9.tmp \ 170 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 171 172 "$SHOWMAIL" < out9.tmp | grep -q 'METHOD:REPLY' \ 173 && echo "Success" \ 174 || echo "Failed" 175 176 grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ 177 && grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \ 178 && echo "Success" \ 179 || echo "Failed"