imip-agent

Annotated tests/test_person_non_participation.sh

1069:37921ab84c01
2016-03-06 Paul Boddie Moved imip_store into a new imiptools.stores package as the file module.
paul@667 1
#!/bin/sh
paul@667 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@667 4
paul@667 5
USER="mailto:vincent.vole@example.com"
paul@836 6
IMPOSTER="mailto:oliver.otter@example.com"
paul@667 7
SENDER="mailto:paul.boddie@example.com"
paul@667 8
FBFILE="$STORE/$USER/freebusy"
paul@667 9
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@836 10
FBIMPOSTERFILE="$STORE/$SENDER/freebusy-other/$IMPOSTER"
paul@667 11
paul@667 12
mkdir -p "$PREFS/$USER"
paul@667 13
echo 'no' > "$PREFS/$USER/participating"
paul@667 14
paul@836 15
mkdir -p "$PREFS/$SENDER"
paul@836 16
echo 'yes' > "$PREFS/$SENDER/participating"
paul@836 17
paul@667 18
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
paul@667 19
| "$SHOWMAIL" \
paul@667 20
> out0.tmp
paul@667 21
paul@667 22
   ! grep -q 'METHOD:REPLY' out0.tmp \
paul@667 23
&& echo "Success" \
paul@667 24
|| echo "Failed"
paul@667 25
paul@836 26
# Show the request to the outgoing handler first.
paul@836 27
paul@836 28
"$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR
paul@836 29
paul@836 30
   [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
paul@836 31
&& echo "Success" \
paul@836 32
|| echo "Failed"
paul@836 33
paul@836 34
# Send a request to the recipient.
paul@836 35
paul@667 36
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person.txt" 2>> $ERROR \
paul@667 37
| "$SHOWMAIL" \
paul@667 38
> out2.tmp
paul@667 39
paul@667 40
   ! grep -q 'METHOD:REPLY' out2.tmp \
paul@667 41
&& echo "Success" \
paul@667 42
|| echo "Failed"
paul@667 43
paul@667 44
   ! [ -e "$FBFILE" ] \
paul@667 45
&& echo "Success" \
paul@667 46
|| echo "Failed"
paul@667 47
paul@667 48
   ! [ -e "$FBOTHERFILE" ] \
paul@667 49
&& echo "Success" \
paul@667 50
|| echo "Failed"
paul@667 51
paul@836 52
# Make sure that the recipient ignored it.
paul@836 53
paul@673 54
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \
paul@667 55
| tee out3.tmp \
paul@673 56
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@667 57
paul@667 58
   ! [ -e "$FBFILE" ] \
paul@667 59
|| ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBFILE" \
paul@667 60
&& echo "Success" \
paul@667 61
|| echo "Failed"
paul@836 62
paul@836 63
# Now see if an imposter can invite themself to the event.
paul@836 64
paul@836 65
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \
paul@836 66
| tee out4.tmp \
paul@836 67
| "$PERSON_SCRIPT" $ARGS 2>> $ERROR \
paul@836 68
| "$SHOWMAIL" \
paul@836 69
> out5.tmp
paul@836 70
paul@836 71
   [ -e "$STORE/$SENDER/objects/event6@example.com" ] \
paul@836 72
&& ! grep -q "otter" "$STORE/$SENDER/objects/event6@example.com" \
paul@836 73
&& echo "Success" \
paul@836 74
|| echo "Failed"
paul@836 75
paul@836 76
   ( ! [ -e "$FBIMPOSTERFILE" ] \
paul@836 77
  || ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "$FBIMPOSTERFILE") \
paul@836 78
&& echo "Success" \
paul@836 79
|| echo "Failed"