imip-agent

Annotated tests/test_person_non_participation.sh

1342:ef0326fbdc1d
2017-10-18 Paul Boddie Merged changes from the default branch. client-editing-simplification
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
paul@667 9
mkdir -p "$PREFS/$USER"
paul@667 10
echo 'no' > "$PREFS/$USER/participating"
paul@667 11
paul@836 12
mkdir -p "$PREFS/$SENDER"
paul@836 13
echo 'yes' > "$PREFS/$SENDER/participating"
paul@836 14
paul@667 15
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/fb-request-person-all.txt" 2>> $ERROR \
paul@667 16
| "$SHOWMAIL" \
paul@667 17
> out0.tmp
paul@667 18
paul@667 19
   ! grep -q 'METHOD:REPLY' out0.tmp \
paul@667 20
&& echo "Success" \
paul@667 21
|| echo "Failed"
paul@667 22
paul@836 23
# Show the request to the outgoing handler first.
paul@836 24
paul@836 25
"$OUTGOING_SCRIPT" < "$TEMPLATES/event-request-person.txt" $ARGS 2>> $ERROR
paul@836 26
paul@1091 27
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event6@example.com" \
paul@1091 28
>  out0O.tmp
paul@1091 29
paul@1091 30
   grep -q "event6@example.com" "out0O.tmp" \
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@1091 44
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1091 45
>  out2f.tmp
paul@1091 46
paul@1091 47
   ! grep -q "event6@example.com" "out2f.tmp" \
paul@667 48
&& echo "Success" \
paul@667 49
|| echo "Failed"
paul@667 50
paul@1091 51
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_other" "$SENDER" \
paul@1091 52
>  out2s.tmp
paul@1091 53
paul@1091 54
   ! grep -q "event6@example.com" "out2s.tmp" \
paul@667 55
&& echo "Success" \
paul@667 56
|| echo "Failed"
paul@667 57
paul@836 58
# Make sure that the recipient ignored it.
paul@836 59
paul@673 60
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" < "$TEMPLATES/event-request-person-object.txt" 2>> $ERROR \
paul@667 61
| tee out3.tmp \
paul@673 62
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@667 63
paul@1091 64
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1091 65
>  out2f.tmp
paul@1091 66
paul@1091 67
   ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \
paul@667 68
&& echo "Success" \
paul@667 69
|| echo "Failed"
paul@836 70
paul@836 71
# Now see if an imposter can invite themself to the event.
paul@836 72
paul@836 73
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$IMPOSTER" < "$TEMPLATES/event-request-person-imposter-object.txt" 2>> $ERROR \
paul@836 74
| tee out4.tmp \
paul@836 75
| "$PERSON_SCRIPT" $ARGS 2>> $ERROR \
paul@836 76
| "$SHOWMAIL" \
paul@836 77
> out5.tmp
paul@836 78
paul@1091 79
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "object" "event6@example.com" \
paul@1091 80
>  out5O.tmp
paul@1091 81
paul@1091 82
   ! grep -q "otter" "out5O.tmp" \
paul@836 83
&& echo "Success" \
paul@836 84
|| echo "Failed"
paul@836 85
paul@1091 86
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$IMPOSTER" \
paul@1091 87
>  out5s.tmp
paul@1091 88
paul@1091 89
   ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out5s.tmp" \
paul@836 90
&& echo "Success" \
paul@836 91
|| echo "Failed"