imip-agent

Annotated tests/test_person_invitation.sh

838:40f53e26c74e
2015-10-15 Paul Boddie Added support for adding suggested attendees from counter-proposals.
paul@585 1
#!/bin/sh
paul@585 2
paul@585 3
THIS_DIR=`dirname $0`
paul@585 4
paul@585 5
TEMPLATES="$THIS_DIR/templates"
paul@585 6
PERSON_SCRIPT="$THIS_DIR/../imip_person.py"
paul@585 7
SHOWMAIL="$THIS_DIR/../tools/showmail.py"
paul@585 8
STORE=/tmp/store
paul@585 9
STATIC=/tmp/static
paul@640 10
PREFS=/tmp/prefs
paul@640 11
ARGS="-S $STORE -P $STATIC -p $PREFS -d"
paul@585 12
USER="mailto:vincent.vole@example.com"
paul@585 13
SENDER="mailto:paul.boddie@example.com"
paul@585 14
FBFILE="$STORE/$USER/freebusy"
paul@585 15
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@585 16
TAB=`printf '\t'`
paul@585 17
paul@585 18
OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
paul@585 19
paul@585 20
PYTHONPATH="$THIS_DIR/.."
paul@585 21
export PYTHONPATH
paul@585 22
paul@587 23
ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
paul@587 24
ACCEPT_ARGS="accept $STORE"
paul@587 25
paul@587 26
DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
paul@587 27
DECLINE_ARGS="decline $STORE"
paul@585 28
paul@602 29
ERROR=err.tmp
paul@602 30
paul@585 31
rm -r $STORE
paul@585 32
rm -r $STATIC
paul@640 33
rm -r $PREFS
paul@602 34
rm $ERROR
paul@602 35
rm out*.tmp
paul@585 36
paul@640 37
mkdir -p "$PREFS/$USER"
paul@640 38
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@640 39
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@640 40
paul@602 41
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
paul@585 42
| "$SHOWMAIL" \
paul@585 43
> out0.tmp
paul@585 44
paul@585 45
   grep -q 'METHOD:REPLY' out0.tmp \
paul@585 46
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@585 47
&& echo "Success" \
paul@585 48
|| echo "Failed"
paul@585 49
paul@602 50
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person.txt" 2>> $ERROR \
paul@585 51
| "$SHOWMAIL" \
paul@585 52
> out1.tmp
paul@585 53
paul@585 54
   grep -q 'METHOD:REPLY' out1.tmp \
paul@585 55
&& ! grep -q '^FREEBUSY' out1.tmp \
paul@585 56
&& echo "Success" \
paul@585 57
|| echo "Failed"
paul@585 58
paul@602 59
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
paul@585 60
| "$SHOWMAIL" \
paul@585 61
> out2.tmp
paul@585 62
paul@585 63
   ! grep -q 'METHOD:REPLY' out2.tmp \
paul@585 64
&& echo "Success" \
paul@585 65
|| echo "Failed"
paul@585 66
paul@708 67
   ! [ -e "$FBFILE" ] \
paul@708 68
|| ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
paul@585 69
&& echo "Success" \
paul@585 70
|| echo "Failed"
paul@585 71
paul@585 72
   grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBOTHERFILE" \
paul@585 73
&& echo "Success" \
paul@585 74
|| echo "Failed"
paul@585 75
paul@673 76
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event6@example.com" 2>> $ERROR \
paul@585 77
| tee out3.tmp \
paul@673 78
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@585 79
paul@585 80
   grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
paul@585 81
&& echo "Success" \
paul@585 82
|| echo "Failed"
paul@587 83
paul@602 84
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-conflict.txt" 2>> $ERROR \
paul@587 85
| "$SHOWMAIL" \
paul@587 86
> out4.tmp
paul@587 87
paul@587 88
   ! grep -q 'METHOD:REPLY' out4.tmp \
paul@587 89
&& echo "Success" \
paul@587 90
|| echo "Failed"
paul@587 91
paul@587 92
   ! grep -q "event7@example.com" "$FBFILE" \
paul@587 93
&& echo "Success" \
paul@587 94
|| echo "Failed"
paul@587 95
paul@587 96
   grep -q "event7@example.com" "$FBOTHERFILE" \
paul@587 97
&& echo "Success" \
paul@587 98
|| echo "Failed"
paul@587 99
paul@673 100
  "$DECLINE_SCRIPT" $DECLINE_ARGS "$USER" "event7@example.com" 2>> $ERROR \
paul@587 101
| tee out5.tmp \
paul@673 102
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@587 103
paul@587 104
   grep -q "event6@example.com" "$FBFILE" \
paul@587 105
&& ! grep -q "event7@example.com" "$FBFILE" \
paul@587 106
&& echo "Success" \
paul@587 107
|| echo "Failed"
paul@590 108
paul@602 109
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person.txt" 2>> $ERROR \
paul@590 110
| "$SHOWMAIL" \
paul@590 111
> out6.tmp
paul@590 112
paul@590 113
   ! grep -q 'METHOD:REPLY' out6.tmp \
paul@590 114
&& echo "Success" \
paul@590 115
|| echo "Failed"
paul@590 116
paul@590 117
   ! grep -q "event6@example.com" "$FBFILE" \
paul@590 118
&& echo "Success" \
paul@590 119
|| echo "Failed"
paul@590 120
paul@590 121
   grep -q "event6@example.com" "$FBOTHERFILE" \
paul@590 122
&& echo "Success" \
paul@590 123
|| echo "Failed"
paul@590 124
paul@602 125
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-all.txt" 2>> $ERROR \
paul@590 126
| "$SHOWMAIL" \
paul@590 127
> out7.tmp
paul@590 128
paul@590 129
   ! grep -q 'METHOD:REPLY' out7.tmp \
paul@590 130
&& echo "Success" \
paul@590 131
|| echo "Failed"
paul@590 132
paul@590 133
   ! grep -q "event6@example.com" "$FBFILE" \
paul@590 134
&& echo "Success" \
paul@590 135
|| echo "Failed"
paul@590 136
paul@590 137
   ! grep -q "event6@example.com" "$FBOTHERFILE" \
paul@590 138
&& echo "Success" \
paul@590 139
|| echo "Failed"
paul@591 140
paul@602 141
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-spoofed.txt" 2>> $ERROR \
paul@591 142
| "$SHOWMAIL" \
paul@591 143
> out8.tmp
paul@591 144
paul@591 145
   ! grep -q 'METHOD:REPLY' out8.tmp \
paul@591 146
&& echo "Success" \
paul@591 147
|| echo "Failed"
paul@591 148
paul@591 149
   ! grep -q "spoof2@example.com" "$FBFILE" \
paul@591 150
&& echo "Success" \
paul@591 151
|| echo "Failed"
paul@591 152
paul@591 153
   ! grep -q "spoof2@example.com" "$FBOTHERFILE" \
paul@591 154
&& echo "Success" \
paul@591 155
|| echo "Failed"