imip-agent

Annotated tests/test_resource_invitation_constraints.sh

686:b5bdf9dcad0f
2015-09-04 Paul Boddie Added docstrings.
paul@655 1
#!/bin/sh
paul@655 2
paul@655 3
THIS_DIR=`dirname $0`
paul@655 4
paul@655 5
TEMPLATES="$THIS_DIR/templates"
paul@655 6
RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"
paul@655 7
SHOWMAIL="$THIS_DIR/../tools/showmail.py"
paul@655 8
STORE=/tmp/store
paul@655 9
STATIC=/tmp/static
paul@655 10
PREFS=/tmp/prefs
paul@655 11
ARGS="-S $STORE -P $STATIC -p $PREFS -d"
paul@655 12
USER="mailto:resource-room-sauna@example.com"
paul@655 13
ERROR=err.tmp
paul@655 14
paul@655 15
rm -r $STORE
paul@655 16
rm -r $STATIC
paul@655 17
rm -r $PREFS
paul@655 18
rm $ERROR
paul@655 19
rm out*.tmp
paul@655 20
paul@655 21
mkdir -p "$PREFS/$USER"
paul@655 22
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@655 23
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@669 24
echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"
paul@655 25
paul@655 26
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@655 27
| "$SHOWMAIL" \
paul@655 28
> out0.tmp
paul@655 29
paul@655 30
   grep -q 'METHOD:REPLY' out0.tmp \
paul@655 31
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@655 32
&& echo "Success" \
paul@655 33
|| echo "Failed"
paul@655 34
paul@655 35
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \
paul@655 36
| "$SHOWMAIL" \
paul@655 37
> out2.tmp
paul@655 38
paul@663 39
   grep -q 'METHOD:COUNTER' out2.tmp \
paul@663 40
&& grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out2.tmp \
paul@655 41
&& echo "Success" \
paul@655 42
|| echo "Failed"
paul@655 43
paul@655 44
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@655 45
| "$SHOWMAIL" \
paul@655 46
> out3.tmp
paul@655 47
paul@655 48
   grep -q 'METHOD:REPLY' out3.tmp \
paul@655 49
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T160000Z' out3.tmp \
paul@663 50
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out3.tmp \
paul@655 51
&& echo "Success" \
paul@655 52
|| echo "Failed"
paul@655 53
paul@655 54
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \
paul@655 55
| "$SHOWMAIL" \
paul@655 56
> out4.tmp
paul@655 57
paul@655 58
   grep -q 'METHOD:REPLY' out4.tmp \
paul@655 59
&& grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out4.tmp \
paul@655 60
&& echo "Success" \
paul@655 61
|| echo "Failed"
paul@655 62
paul@655 63
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@655 64
| "$SHOWMAIL" \
paul@655 65
> out6.tmp
paul@655 66
paul@655 67
   grep -q 'METHOD:REPLY' out6.tmp \
paul@655 68
&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T151500Z' out6.tmp \
paul@655 69
&& echo "Success" \
paul@655 70
|| echo "Failed"