2015-10-17 | Paul Boddie | raw annotate files changeset graph | Consolidated descriptions of events for both REFRESH requests and for messages sent by the manager, bundling the necessary REQUEST and CANCEL payloads to describe events and their recurrences. Changed organiser-sent messages in the manager to be also sent to the user's own address, not the people-outgoing version of that address, adding support for self-sent CANCEL messages in the person handler. Added the removal of cancelled recurrences to restore periods in events edited in the manager. Otherwise, such periods can never be restored. Expanded the REFRESH method tests. |
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 IMPOSTER="mailto:oliver.otter@example.com" 14 SENDER="mailto:paul.boddie@example.com" 15 FBFILE="$STORE/$USER/freebusy" 16 FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER" 17 FBIMPOSTERFILE="$STORE/$SENDER/freebusy-other/$IMPOSTER" 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 'no' > "$PREFS/$USER/participating" 41 42 mkdir -p "$PREFS/$SENDER" 43 echo 'yes' > "$PREFS/$SENDER/participating" 44 45 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \ 46 | "$SHOWMAIL" \ 47 > out0.tmp 48 49 ! grep -q 'METHOD:REPLY' out0.tmp \ 50 && echo "Success" \ 51 || echo "Failed" 52 53 # Show the request to the outgoing handler first. 54 55 "$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR 56 57 [ -e "$STORE/$SENDER/objects/event6@example.com" ] \ 58 && echo "Success" \ 59 || echo "Failed" 60 61 # Send a request to the recipient. 62 63 "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \ 64 | "$SHOWMAIL" \ 65 > out2.tmp 66 67 ! grep -q 'METHOD:REPLY' out2.tmp \ 68 && echo "Success" \ 69 || echo "Failed" 70 71 ! [ -e "$FBFILE" ] \ 72 && echo "Success" \ 73 || echo "Failed" 74 75 ! [ -e "$FBOTHERFILE" ] \ 76 && echo "Success" \ 77 || echo "Failed" 78 79 # Make sure that the recipient ignored it. 80 81 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \ 82 | tee out3.tmp \ 83 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR 84 85 ! [ -e "$FBFILE" ] \ 86 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ 87 && echo "Success" \ 88 || echo "Failed" 89 90 # Now see if an imposter can invite themself to the event. 91 92 "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \ 93 | tee out4.tmp \ 94 | "$PERSON_SCRIPT" $ARGS 2>> $ERROR \ 95 | "$SHOWMAIL" \ 96 > out5.tmp 97 98 [ -e "$STORE/$SENDER/objects/event6@example.com" ] \ 99 && ! grep -q "otter" "$STORE/$SENDER/objects/event6@example.com" \ 100 && echo "Success" \ 101 || echo "Failed" 102 103 ( ! [ -e "$FBIMPOSTERFILE" ] \ 104 || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBIMPOSTERFILE") \ 105 && echo "Success" \ 106 || echo "Failed"