imip-agent

Annotated tests/test_resource_invitation_add.sh

1310:cadb986c2dec
2017-10-14 Paul Boddie Added a function that identifies overlapping periods within a collection.
paul@737 1
#!/bin/sh
paul@737 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@737 4
paul@737 5
USER="mailto:resource-room-confroom@example.com"
paul@737 6
SENDER="mailto:paul.boddie@example.com"
paul@737 7
paul@737 8
mkdir -p "$PREFS/$USER"
paul@737 9
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@737 10
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@737 11
paul@737 12
mkdir -p "$PREFS/$SENDER"
paul@737 13
echo 'Europe/Oslo' > "$PREFS/$SENDER/TZID"
paul@737 14
echo 'always' > "$PREFS/$SENDER/event_refreshing"
paul@737 15
paul@737 16
# Publish an event, testing registration in the outgoing handler.
paul@737 17
paul@737 18
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR
paul@737 19
paul@1089 20
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1089 21
|  tee out0f.tmp \
paul@1089 22
|  grep -q "^20141212T090000Z${TAB}20141212T100000Z" \
paul@737 23
&& echo "Success" \
paul@737 24
|| echo "Failed"
paul@737 25
paul@737 26
# Present the request to the recipient.
paul@737 27
paul@737 28
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-recurring.txt" 2>> $ERROR \
paul@737 29
| "$SHOWMAIL" \
paul@737 30
> out1.tmp
paul@737 31
paul@737 32
   grep -q 'METHOD:REPLY' out1.tmp \
paul@737 33
&& echo "Success" \
paul@737 34
|| echo "Failed"
paul@737 35
paul@1089 36
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 37
| tee out1f.tmp \
paul@1089 38
| grep -q "^20141212T090000Z${TAB}20141212T100000Z" \
paul@737 39
&& echo "Success" \
paul@737 40
|| echo "Failed"
paul@737 41
paul@737 42
# Present the response to the sender.
paul@737 43
paul@737 44
  "$PERSON_SCRIPT" $ARGS < out1.tmp 2>> $ERROR \
paul@737 45
| "$SHOWMAIL" \
paul@737 46
> out2.tmp
paul@737 47
paul@1089 48
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
paul@1089 49
|  tee out2o.tmp \
paul@1089 50
|  grep -q "^20141212T090000Z${TAB}20141212T100000Z" \
paul@737 51
&& echo "Success" \
paul@737 52
|| echo "Failed"
paul@737 53
paul@737 54
# Attempt to add an occurrence to the event.
paul@737 55
paul@737 56
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR
paul@737 57
paul@1089 58
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1089 59
>  out2f.tmp
paul@1089 60
paul@1089 61
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out2f.tmp" \
paul@1089 62
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out2f.tmp" \
paul@737 63
&& echo "Success" \
paul@737 64
|| echo "Failed"
paul@737 65
paul@737 66
# Present the request to the recipient.
paul@737 67
paul@737 68
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-add-recurring.txt" 2>> $ERROR \
paul@737 69
| "$SHOWMAIL" \
paul@737 70
> out3.tmp
paul@737 71
paul@737 72
   grep -q 'METHOD:REFRESH' out3.tmp \
paul@737 73
&& echo "Success" \
paul@737 74
|| echo "Failed"
paul@737 75
paul@1089 76
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 77
>  out3f.tmp
paul@1089 78
paul@1089 79
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out3f.tmp" \
paul@1089 80
&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out3f.tmp" \
paul@737 81
&& echo "Success" \
paul@737 82
|| echo "Failed"
paul@737 83
paul@737 84
# Present the refresh message to the organiser.
paul@737 85
paul@737 86
  "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
paul@866 87
| tee out4r.tmp \
paul@737 88
| "$SHOWMAIL" \
paul@737 89
> out4.tmp
paul@737 90
paul@737 91
   grep -q 'METHOD:REQUEST' out4.tmp \
paul@737 92
&& echo "Success" \
paul@737 93
|| echo "Failed"
paul@737 94
paul@737 95
# Present the request to the recipient.
paul@737 96
paul@866 97
  "$RESOURCE_SCRIPT" $ARGS < out4r.tmp 2>> $ERROR \
paul@737 98
| tee out5r.tmp \
paul@737 99
| "$SHOWMAIL" \
paul@737 100
> out5.tmp
paul@737 101
paul@737 102
   grep -q 'METHOD:REPLY' out5.tmp \
paul@737 103
&& echo "Success" \
paul@737 104
|| echo "Failed"
paul@737 105
paul@1089 106
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 107
>  out5f.tmp
paul@1089 108
paul@1089 109
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out5f.tmp" \
paul@1089 110
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out5f.tmp" \
paul@737 111
&& echo "Success" \
paul@737 112
|| echo "Failed"
paul@737 113
paul@737 114
# Present the response to the sender.
paul@737 115
paul@737 116
  "$PERSON_SCRIPT" $ARGS < out5r.tmp 2>> $ERROR \
paul@737 117
| "$SHOWMAIL" \
paul@737 118
> out6.tmp
paul@737 119
paul@1089 120
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
paul@1089 121
>  out6o.tmp
paul@1089 122
paul@1089 123
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "out6o.tmp" \
paul@1089 124
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "out6o.tmp" \
paul@737 125
&& echo "Success" \
paul@737 126
|| echo "Failed"