imip-agent

Annotated tests/test_person_invitation_refresh.sh

1065:2175787d1896
2016-03-04 Paul Boddie Merged changes from the default branch. freebusy-collections
paul@688 1
#!/bin/sh
paul@688 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@688 4
paul@688 5
USER="mailto:vincent.vole@example.com"
paul@688 6
SENDER="mailto:paul.boddie@example.com"
paul@688 7
FBFILE="$STORE/$USER/freebusy"
paul@688 8
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@688 9
FBSENDERFILE="$STORE/$SENDER/freebusy"
paul@688 10
paul@688 11
mkdir -p "$PREFS/$USER"
paul@688 12
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@688 13
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@861 14
echo 'add' > "$PREFS/$USER/add_method_response"
paul@688 15
paul@688 16
mkdir -p "$PREFS/$SENDER"
paul@688 17
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@688 18
echo 'always' > "$PREFS/$SENDER/event_refreshing"
paul@688 19
paul@688 20
# Publish an event, testing registration in the outgoing handler.
paul@688 21
paul@688 22
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
paul@688 23
paul@688 24
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
paul@688 25
&& echo "Success" \
paul@688 26
|| echo "Failed"
paul@688 27
paul@688 28
# Test a request from an attendee for the event details to be refreshed.
paul@688 29
paul@688 30
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@688 31
| "$SHOWMAIL" \
paul@688 32
> out2.tmp
paul@688 33
paul@688 34
   grep -q 'METHOD:REQUEST' out2.tmp \
paul@688 35
&& echo "Success" \
paul@688 36
|| echo "Failed"
paul@688 37
paul@688 38
# Present the result to the recipient.
paul@688 39
paul@688 40
  "$PERSON_SCRIPT" $ARGS < out2.tmp 2>> $ERROR \
paul@688 41
| "$SHOWMAIL" \
paul@688 42
> out3.tmp
paul@688 43
paul@688 44
   ! grep -q 'METHOD:REPLY' out3.tmp \
paul@688 45
&& echo "Success" \
paul@688 46
|| echo "Failed"
paul@688 47
paul@708 48
   ! [ -e "$FBFILE" ] \
paul@708 49
|| ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@688 50
&& echo "Success" \
paul@688 51
|| echo "Failed"
paul@688 52
paul@688 53
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
paul@688 54
&& echo "Success" \
paul@688 55
|| echo "Failed"
paul@688 56
paul@688 57
# Test acceptance and registration in the outgoing handler.
paul@688 58
paul@688 59
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
paul@688 60
| tee out4.tmp \
paul@688 61
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@688 62
paul@688 63
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@688 64
&& echo "Success" \
paul@688 65
|| echo "Failed"
paul@688 66
paul@688 67
# Test a request from a non-attendee for the event details to be refreshed.
paul@688 68
paul@688 69
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring-non-attendee.txt" 2>> $ERROR \
paul@688 70
| "$SHOWMAIL" \
paul@688 71
> out5.tmp
paul@688 72
paul@688 73
   ! grep -q 'METHOD:REQUEST' out5.tmp \
paul@688 74
&& echo "Success" \
paul@688 75
|| echo "Failed"
paul@691 76
paul@691 77
# Test rescheduling in the outgoing handler.
paul@691 78
paul@691 79
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR
paul@691 80
paul@691 81
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \
paul@691 82
&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \
paul@691 83
&& echo "Success" \
paul@691 84
|| echo "Failed"
paul@691 85
paul@691 86
# Test another request from an attendee for the event details to be refreshed.
paul@691 87
paul@691 88
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@864 89
| tee out6r.tmp \
paul@691 90
| "$SHOWMAIL" \
paul@691 91
> out6.tmp
paul@691 92
paul@691 93
   grep -q 'METHOD:REQUEST' out6.tmp \
paul@691 94
&& grep -q 'RECURRENCE-ID' out6.tmp \
paul@691 95
&& [ `grep 'BEGIN:VEVENT' out6.tmp | wc -l` = '2' ] \
paul@691 96
&& echo "Success" \
paul@691 97
|| echo "Failed"
paul@691 98
paul@861 99
# Process the resulting message.
paul@861 100
paul@864 101
  "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \
paul@861 102
| "$SHOWMAIL" \
paul@861 103
> out6a.tmp
paul@861 104
paul@861 105
   [ -e "$STORE/$USER/objects/event8@example.com" ] \
paul@861 106
&& [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 107
&& echo "Success" \
paul@861 108
|| echo "Failed"
paul@861 109
paul@694 110
# Cancel a recurrence. Both the original and rescheduled recurrences should be
paul@694 111
# absent from the free/busy collection.
paul@691 112
paul@691 113
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-rescheduled-instance.txt" 2>> $ERROR
paul@691 114
paul@861 115
   [ -e "$STORE/$SENDER/objects/event8@example.com" ] \
paul@861 116
&& ! [ -e "$STORE/$SENDER/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 117
&& [ -e "$STORE/$SENDER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 118
&& echo "Success" \
paul@861 119
|| echo "Failed"
paul@861 120
paul@694 121
   ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \
paul@694 122
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \
paul@691 123
&& echo "Success" \
paul@691 124
|| echo "Failed"
paul@691 125
paul@691 126
# Test another request from an attendee for the event details to be refreshed.
paul@691 127
# The additional recurrence should now be absent.
paul@691 128
paul@691 129
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@861 130
| tee out7r.tmp \
paul@691 131
| "$SHOWMAIL" \
paul@691 132
> out7.tmp
paul@691 133
paul@691 134
   grep -q 'METHOD:REQUEST' out7.tmp \
paul@861 135
&& grep -q 'METHOD:CANCEL' out7.tmp \
paul@861 136
&& [ `grep 'BEGIN:VEVENT' out7.tmp | wc -l` = '2' ] \
paul@861 137
&& echo "Success" \
paul@861 138
|| echo "Failed"
paul@861 139
paul@861 140
# Process the resulting message.
paul@861 141
paul@861 142
  "$PERSON_SCRIPT" $ARGS < out7r.tmp 2>> $ERROR \
paul@861 143
| "$SHOWMAIL" \
paul@861 144
> out7a.tmp
paul@861 145
paul@861 146
   [ -e "$STORE/$USER/objects/event8@example.com" ] \
paul@861 147
&& ! [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 148
&& [ -e "$STORE/$USER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 149
&& echo "Success" \
paul@861 150
|| echo "Failed"
paul@861 151
paul@861 152
# Re-add the cancelled instance.
paul@861 153
paul@861 154
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR
paul@861 155
paul@861 156
   grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \
paul@861 157
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \
paul@691 158
&& echo "Success" \
paul@691 159
|| echo "Failed"
paul@861 160
paul@861 161
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring-rescheduled-instance.txt" 2>> $ERROR \
paul@861 162
| "$SHOWMAIL" \
paul@861 163
> out8.tmp
paul@861 164
paul@861 165
   [ -e "$STORE/$USER/objects/event8@example.com" ] \
paul@861 166
&& [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 167
&& ! [ -e "$STORE/$USER/cancellations/recurrences/event8@example.com/20141010T080000Z" ] \
paul@861 168
&& echo "Success" \
paul@861 169
|| echo "Failed"
paul@861 170
paul@861 171
   ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \
paul@861 172
&& echo "Success" \
paul@861 173
|| echo "Failed"
paul@861 174
paul@861 175
   grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBOTHERFILE" \
paul@861 176
&& echo "Success" \
paul@861 177
|| echo "Failed"
paul@861 178
paul@861 179
# Test acceptance and registration in the outgoing handler.
paul@861 180
paul@861 181
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20141010T080000Z" 2>> $ERROR \
paul@861 182
| tee out9.tmp \
paul@861 183
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@861 184
paul@861 185
   grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBFILE" \
paul@861 186
&& echo "Success" \
paul@861 187
|| echo "Failed"
paul@864 188
paul@864 189
# Test yet another request from an attendee for the event details to be refreshed.
paul@864 190
paul@864 191
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@864 192
| tee out10r.tmp \
paul@864 193
| "$SHOWMAIL" \
paul@864 194
> out10.tmp
paul@864 195
paul@864 196
   grep -q 'METHOD:REQUEST' out10.tmp \
paul@864 197
&& grep -q 'RECURRENCE-ID' out10.tmp \
paul@864 198
&& [ `grep 'BEGIN:VEVENT' out10.tmp | wc -l` = '2' ] \
paul@864 199
&& echo "Success" \
paul@864 200
|| echo "Failed"
paul@864 201
paul@864 202
# Process the resulting message.
paul@864 203
paul@864 204
  "$PERSON_SCRIPT" $ARGS < out10r.tmp 2>> $ERROR \
paul@864 205
| "$SHOWMAIL" \
paul@864 206
> out11.tmp
paul@864 207
paul@864 208
   [ -e "$STORE/$USER/objects/event8@example.com" ] \
paul@864 209
&& [ -e "$STORE/$USER/recurrences/event8@example.com/20141010T080000Z" ] \
paul@864 210
&& echo "Success" \
paul@864 211
|| echo "Failed"