paul@576 | 1 | #!/bin/sh |
paul@576 | 2 | |
paul@576 | 3 | THIS_DIR=`dirname $0` |
paul@576 | 4 | |
paul@585 | 5 | TEMPLATES="$THIS_DIR/templates" |
paul@585 | 6 | OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py" |
paul@585 | 7 | SHOWMAIL="$THIS_DIR/../tools/showmail.py" |
paul@576 | 8 | STORE=/tmp/store |
paul@576 | 9 | STATIC=/tmp/static |
paul@640 | 10 | PREFS=/tmp/prefs |
paul@640 | 11 | ARGS="-S $STORE -P $STATIC -p $PREFS -d" |
paul@576 | 12 | USER="mailto:paul.boddie@example.com" |
paul@576 | 13 | FBFILE="$STORE/$USER/freebusy" |
paul@576 | 14 | TAB=`printf '\t'` |
paul@602 | 15 | ERROR=err.tmp |
paul@576 | 16 | |
paul@576 | 17 | rm -r $STORE |
paul@576 | 18 | rm -r $STATIC |
paul@640 | 19 | rm -r $PREFS |
paul@602 | 20 | rm $ERROR |
paul@602 | 21 | rm out*.tmp |
paul@576 | 22 | |
paul@640 | 23 | mkdir -p "$PREFS/$USER" |
paul@640 | 24 | echo 'Europe/Oslo' > "$PREFS/$USER/TZID" |
paul@640 | 25 | echo 'share' > "$PREFS/$USER/freebusy_sharing" |
paul@640 | 26 | |
paul@602 | 27 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR |
paul@578 | 28 | cp "$FBFILE" out1.tmp |
paul@576 | 29 | |
paul@576 | 30 | grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \ |
paul@576 | 31 | && echo "Success" \ |
paul@576 | 32 | || echo "Failed" |
paul@576 | 33 | |
paul@602 | 34 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel.txt" 2>> $ERROR |
paul@576 | 35 | echo "Cancel..." |
paul@578 | 36 | cp "$FBFILE" out2.tmp |
paul@576 | 37 | |
paul@578 | 38 | ! grep -q '^2' "$FBFILE" \ |
paul@576 | 39 | && echo "Success" \ |
paul@576 | 40 | || echo "Failed" |
paul@576 | 41 | |
paul@602 | 42 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR |
paul@578 | 43 | cp "$FBFILE" out3.tmp |
paul@576 | 44 | |
paul@576 | 45 | [ `cat "$FBFILE" | wc -l` = '3' ] \ |
paul@576 | 46 | && grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@576 | 47 | && echo "Success" \ |
paul@576 | 48 | || echo "Failed" |
paul@576 | 49 | |
paul@602 | 50 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-instance.txt" 2>> $ERROR |
paul@578 | 51 | cp "$FBFILE" out4.tmp |
paul@576 | 52 | |
paul@576 | 53 | [ `cat "$FBFILE" | wc -l` = '2' ] \ |
paul@576 | 54 | && ! grep -q "^20141114T090000Z${TAB}20141114T100000Z" "$FBFILE" \ |
paul@576 | 55 | && echo "Success" \ |
paul@576 | 56 | || echo "Failed" |
paul@576 | 57 | |
paul@602 | 58 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-reschedule-instance.txt" 2>> $ERROR |
paul@578 | 59 | cp "$FBFILE" out5.tmp |
paul@576 | 60 | |
paul@576 | 61 | grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBFILE" \ |
paul@576 | 62 | && ! grep -q "^20141010T090000Z${TAB}20141010T100000Z" "$FBFILE" \ |
paul@576 | 63 | && echo "Success" \ |
paul@576 | 64 | || echo "Failed" |
paul@576 | 65 | |
paul@602 | 66 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring.txt" 2>> $ERROR |
paul@578 | 67 | cp "$FBFILE" out6.tmp |
paul@576 | 68 | |
paul@578 | 69 | ! grep -q '^2' "$FBFILE" \ |
paul@576 | 70 | && echo "Success" \ |
paul@576 | 71 | || echo "Failed" |
paul@578 | 72 | |
paul@602 | 73 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR |
paul@578 | 74 | cp "$FBFILE" out7.tmp |
paul@578 | 75 | |
paul@578 | 76 | [ `cat "$FBFILE" | wc -l` = '3' ] \ |
paul@578 | 77 | && grep -q "^20141211T230000Z${TAB}20141212T230000Z" "$FBFILE" \ |
paul@578 | 78 | && echo "Success" \ |
paul@578 | 79 | || echo "Failed" |
paul@644 | 80 | |
paul@644 | 81 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR |
paul@644 | 82 | cp "$FBFILE" out8.tmp |
paul@644 | 83 | |
paul@644 | 84 | ! grep -q '^2' "$FBFILE" \ |
paul@644 | 85 | && echo "Success" \ |
paul@644 | 86 | || echo "Failed" |
paul@644 | 87 | |
paul@644 | 88 | # Switch time zones. |
paul@644 | 89 | |
paul@644 | 90 | echo 'Europe/Mariehamn' > "$PREFS/$USER/TZID" |
paul@644 | 91 | |
paul@644 | 92 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR |
paul@644 | 93 | cp "$FBFILE" out9.tmp |
paul@644 | 94 | |
paul@644 | 95 | [ `cat "$FBFILE" | wc -l` = '3' ] \ |
paul@644 | 96 | && grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \ |
paul@644 | 97 | && echo "Success" \ |
paul@644 | 98 | || echo "Failed" |
paul@644 | 99 | |
paul@644 | 100 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring.txt" 2>> $ERROR |
paul@644 | 101 | cp "$FBFILE" out10.tmp |
paul@644 | 102 | |
paul@644 | 103 | ! grep -q '^2' "$FBFILE" \ |
paul@644 | 104 | && echo "Success" \ |
paul@644 | 105 | || echo "Failed" |
paul@644 | 106 | |
paul@644 | 107 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring-day.txt" 2>> $ERROR |
paul@644 | 108 | cp "$FBFILE" out11.tmp |
paul@644 | 109 | |
paul@644 | 110 | [ `cat "$FBFILE" | wc -l` = '3' ] \ |
paul@644 | 111 | && grep -q "^20141211T230000Z${TAB}20141212T230000Z" "$FBFILE" \ |
paul@644 | 112 | && echo "Success" \ |
paul@644 | 113 | || echo "Failed" |
paul@644 | 114 | |
paul@644 | 115 | "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-recurring-day.txt" 2>> $ERROR |
paul@644 | 116 | cp "$FBFILE" out12.tmp |
paul@644 | 117 | |
paul@644 | 118 | ! grep -q '^2' "$FBFILE" \ |
paul@644 | 119 | && echo "Success" \ |
paul@644 | 120 | || echo "Failed" |