imip-agent

Annotated tests/test_person_non_participation.sh

871:b38466ae1e51
2015-10-18 Paul Boddie Handle rule-based occurrences as exceptions when removed by attendees for counter-proposals.
paul@667 1
#!/bin/sh
paul@667 2
paul@667 3
THIS_DIR=`dirname $0`
paul@667 4
paul@667 5
TEMPLATES="$THIS_DIR/templates"
paul@667 6
PERSON_SCRIPT="$THIS_DIR/../imip_person.py"
paul@667 7
SHOWMAIL="$THIS_DIR/../tools/showmail.py"
paul@667 8
STORE=/tmp/store
paul@667 9
STATIC=/tmp/static
paul@667 10
PREFS=/tmp/prefs
paul@667 11
ARGS="-S $STORE -P $STATIC -p $PREFS -d"
paul@667 12
USER="mailto:vincent.vole@example.com"
paul@836 13
IMPOSTER="mailto:oliver.otter@example.com"
paul@667 14
SENDER="mailto:paul.boddie@example.com"
paul@667 15
FBFILE="$STORE/$USER/freebusy"
paul@667 16
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@836 17
FBIMPOSTERFILE="$STORE/$SENDER/freebusy-other/$IMPOSTER"
paul@667 18
TAB=`printf '\t'`
paul@667 19
paul@667 20
OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
paul@667 21
paul@667 22
PYTHONPATH="$THIS_DIR/.."
paul@667 23
export PYTHONPATH
paul@667 24
paul@667 25
ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
paul@667 26
ACCEPT_ARGS="accept $STORE"
paul@667 27
paul@667 28
DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
paul@667 29
DECLINE_ARGS="decline $STORE"
paul@667 30
paul@667 31
ERROR=err.tmp
paul@667 32
paul@667 33
rm -r $STORE
paul@667 34
rm -r $STATIC
paul@667 35
rm -r $PREFS
paul@667 36
rm $ERROR
paul@667 37
rm out*.tmp
paul@667 38
paul@667 39
mkdir -p "$PREFS/$USER"
paul@667 40
echo 'no' > "$PREFS/$USER/participating"
paul@667 41
paul@836 42
mkdir -p "$PREFS/$SENDER"
paul@836 43
echo 'yes' > "$PREFS/$SENDER/participating"
paul@836 44
paul@667 45
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
paul@667 46
| "$SHOWMAIL" \
paul@667 47
> out0.tmp
paul@667 48
paul@667 49
   ! grep -q 'METHOD:REPLY' out0.tmp \
paul@667 50
&& echo "Success" \
paul@667 51
|| echo "Failed"
paul@667 52
paul@836 53
# Show the request to the outgoing handler first.
paul@836 54
paul@836 55
"$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR
paul@836 56
paul@836 57
   [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
paul@836 58
&& echo "Success" \
paul@836 59
|| echo "Failed"
paul@836 60
paul@836 61
# Send a request to the recipient.
paul@836 62
paul@667 63
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
paul@667 64
| "$SHOWMAIL" \
paul@667 65
> out2.tmp
paul@667 66
paul@667 67
   ! grep -q 'METHOD:REPLY' out2.tmp \
paul@667 68
&& echo "Success" \
paul@667 69
|| echo "Failed"
paul@667 70
paul@667 71
   ! [ -e "$FBFILE" ] \
paul@667 72
&& echo "Success" \
paul@667 73
|| echo "Failed"
paul@667 74
paul@667 75
   ! [ -e "$FBOTHERFILE" ] \
paul@667 76
&& echo "Success" \
paul@667 77
|| echo "Failed"
paul@667 78
paul@836 79
# Make sure that the recipient ignored it.
paul@836 80
paul@673 81
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \
paul@667 82
| tee out3.tmp \
paul@673 83
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@667 84
paul@667 85
   ! [ -e "$FBFILE" ] \
paul@667 86
|| ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
paul@667 87
&& echo "Success" \
paul@667 88
|| echo "Failed"
paul@836 89
paul@836 90
# Now see if an imposter can invite themself to the event.
paul@836 91
paul@836 92
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \
paul@836 93
| tee out4.tmp \
paul@836 94
| "$PERSON_SCRIPT" $ARGS 2>> $ERROR \
paul@836 95
| "$SHOWMAIL" \
paul@836 96
> out5.tmp
paul@836 97
paul@836 98
   [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
paul@836 99
&& ! grep -q "otter" "$STORE/$SENDER/objects/event6@example.com" \
paul@836 100
&& echo "Success" \
paul@836 101
|| echo "Failed"
paul@836 102
paul@836 103
   ( ! [ -e "$FBIMPOSTERFILE" ] \
paul@836 104
  || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBIMPOSTERFILE") \
paul@836 105
&& echo "Success" \
paul@836 106
|| echo "Failed"