imip-agent

Annotated tests/test_resource_invitation_constraints.sh

1370:b4544a1a80c1
2017-10-25 Paul Boddie Moved period collection abstractions into the period module.
paul@655 1
#!/bin/sh
paul@655 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@655 4
paul@655 5
USER="mailto:resource-room-sauna@example.com"
paul@743 6
SENDER="mailto:paul.boddie@example.com"
paul@743 7
RIVALSENDER="mailto:vincent.vole@example.com"
paul@655 8
paul@655 9
mkdir -p "$PREFS/$USER"
paul@655 10
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@655 11
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@938 12
echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"
paul@669 13
echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"
paul@759 14
echo 'PT60S' > "$PREFS/$USER/freebusy_offers"
paul@655 15
paul@655 16
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@655 17
| "$SHOWMAIL" \
paul@655 18
> out0.tmp
paul@655 19
paul@655 20
   grep -q 'METHOD:REPLY' out0.tmp \
paul@655 21
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@655 22
&& echo "Success" \
paul@655 23
|| echo "Failed"
paul@655 24
paul@743 25
# Attempt to schedule an event.
paul@743 26
paul@743 27
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR
paul@743 28
paul@1089 29
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1089 30
|  tee out0f.tmp \
paul@1089 31
|  grep -q "^20141126T151000Z${TAB}20141126T154500Z" \
paul@743 32
&& echo "Success" \
paul@743 33
|| echo "Failed"
paul@743 34
paul@743 35
# Present the request to the resource.
paul@743 36
paul@655 37
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \
paul@802 38
| tee out1r.tmp \
paul@655 39
| "$SHOWMAIL" \
paul@742 40
> out1.tmp
paul@655 41
paul@742 42
   grep -q 'METHOD:COUNTER' out1.tmp \
paul@742 43
&& grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \
paul@655 44
&& echo "Success" \
paul@655 45
|| echo "Failed"
paul@655 46
paul@1089 47
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 48
>  out1f.tmp
paul@1089 49
paul@1089 50
   ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out1f.tmp" \
paul@742 51
&& echo "Success" \
paul@742 52
|| echo "Failed"
paul@742 53
paul@1089 54
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
paul@1089 55
|  tee out1o.tmp \
paul@1089 56
|  grep -q "^20141126T151500Z${TAB}20141126T154500Z" \
paul@710 57
&& echo "Success" \
paul@710 58
|| echo "Failed"
paul@710 59
paul@743 60
# Present the response to the organiser.
paul@742 61
paul@802 62
  "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \
paul@743 63
| tee out2r.tmp \
paul@742 64
| "$SHOWMAIL" \
paul@742 65
> out2.tmp
paul@742 66
paul@1089 67
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \
paul@1089 68
>  out2f.tmp
paul@1089 69
paul@1089 70
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out2f.tmp" \
paul@743 71
&& echo "Success" \
paul@743 72
|| echo "Failed"
paul@743 73
paul@1089 74
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event13@example.com" \
paul@1089 75
|  tee out2O.tmp \
paul@1089 76
|  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' \
paul@747 77
&& echo "Success" \
paul@747 78
|| echo "Failed"
paul@747 79
paul@1089 80
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \
paul@1089 81
|  tee out2C.tmp \
paul@1089 82
|  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' \
paul@747 83
&& echo "Success" \
paul@747 84
|| echo "Failed"
paul@747 85
paul@1089 86
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \
paul@1089 87
|  tee out2r.tmp \
paul@1089 88
|  grep -q 'event13@example.com' \
paul@710 89
&& echo "Success" \
paul@710 90
|| echo "Failed"
paul@710 91
paul@743 92
# Attempt to schedule an event in the proposed period.
paul@743 93
paul@743 94
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR
paul@743 95
paul@1089 96
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \
paul@1089 97
>  out2R.tmp
paul@1089 98
paul@1089 99
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out2R.tmp" \
paul@1089 100
&& grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out2R.tmp" \
paul@743 101
&& echo "Success" \
paul@743 102
|| echo "Failed"
paul@743 103
paul@743 104
# Present the request to the resource.
paul@743 105
paul@743 106
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \
paul@1153 107
| tee out3r.tmp \
paul@655 108
| "$SHOWMAIL" \
paul@655 109
> out3.tmp
paul@655 110
paul@655 111
   grep -q 'METHOD:REPLY' out3.tmp \
paul@746 112
&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out3.tmp \
paul@743 113
&& echo "Success" \
paul@743 114
|| echo "Failed"
paul@743 115
paul@743 116
# Present the response to the organiser.
paul@743 117
paul@1153 118
  "$PERSON_SCRIPT" $ARGS < out3r.tmp 2>> $ERROR \
paul@743 119
| tee out4r.tmp \
paul@743 120
| "$SHOWMAIL" \
paul@743 121
> out4.tmp
paul@743 122
paul@1089 123
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \
paul@1089 124
>  out4R.tmp
paul@1089 125
paul@1089 126
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out4R.tmp" \
paul@1089 127
&& grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out4R.tmp" \
paul@743 128
&& echo "Success" \
paul@743 129
|| echo "Failed"
paul@743 130
paul@1089 131
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "object" "event18@example.com" \
paul@1089 132
|  tee out4O.tmp \
paul@1089 133
|  grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' \
paul@655 134
&& echo "Success" \
paul@655 135
|| echo "Failed"
paul@655 136
paul@743 137
# Check the free/busy state of the resource so far.
paul@743 138
paul@743 139
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@743 140
| "$SHOWMAIL" \
paul@743 141
> out5.tmp
paul@743 142
paul@743 143
   grep -q 'METHOD:REPLY' out5.tmp \
paul@743 144
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out5.tmp \
paul@743 145
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out5.tmp \
paul@743 146
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out5.tmp \
paul@743 147
&& echo "Success" \
paul@743 148
|| echo "Failed"
paul@743 149
paul@743 150
# Attempt to schedule again in response to the counter-proposal.
paul@743 151
paul@743 152
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR
paul@743 153
paul@1089 154
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1089 155
>  out5f.tmp
paul@1089 156
paul@1089 157
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out5f.tmp" \
paul@1089 158
&& ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out5f.tmp" \
paul@1089 159
&& ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out5f.tmp" \
paul@743 160
&& echo "Success" \
paul@743 161
|| echo "Failed"
paul@743 162
paul@760 163
   [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \
paul@747 164
&& echo "Success" \
paul@747 165
|| echo "Failed"
paul@747 166
paul@1089 167
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \
paul@1089 168
>  out5r.tmp
paul@1089 169
paul@1089 170
   ! grep -q 'event13@example.com' "out5r.tmp" \
paul@747 171
&& echo "Success" \
paul@747 172
|| echo "Failed"
paul@747 173
paul@743 174
# Present the request to the resource.
paul@743 175
paul@655 176
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-good.txt" 2>> $ERROR \
paul@655 177
| "$SHOWMAIL" \
paul@743 178
> out6.tmp
paul@655 179
paul@743 180
   grep -q 'METHOD:REPLY' out6.tmp \
paul@746 181
&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out6.tmp \
paul@655 182
&& echo "Success" \
paul@655 183
|| echo "Failed"
paul@655 184
paul@1089 185
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 186
|  tee out6f.tmp \
paul@1089 187
|  grep -q "^20141126T150000Z${TAB}20141126T154500Z" \
paul@710 188
&& echo "Success" \
paul@710 189
|| echo "Failed"
paul@710 190
paul@1089 191
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
paul@1089 192
>  out6o.tmp
paul@1089 193
paul@1089 194
   ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out6o.tmp" \
paul@1089 195
&& ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out6o.tmp" \
paul@1089 196
&& ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out6o.tmp" \
paul@710 197
&& echo "Success" \
paul@710 198
|| echo "Failed"
paul@710 199
paul@743 200
# Present the response to the organiser.
paul@743 201
paul@743 202
  "$PERSON_SCRIPT" $ARGS < out6.tmp 2>> $ERROR \
paul@743 203
| tee out7r.tmp \
paul@743 204
| "$SHOWMAIL" \
paul@743 205
> out7.tmp
paul@743 206
paul@1089 207
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \
paul@1089 208
>  out7f.tmp
paul@1089 209
paul@1089 210
   grep -q "^20141126T150000Z${TAB}20141126T154500Z" "out7f.tmp" \
paul@1089 211
&& ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out7f.tmp" \
paul@1089 212
&& ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out7f.tmp" \
paul@1089 213
&& ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out7f.tmp" \
paul@743 214
&& echo "Success" \
paul@743 215
|| echo "Failed"
paul@743 216
paul@760 217
   [ ! -e "$STORE/$SENDER/counters/objects/event13@example.com/$USER" ] \
paul@747 218
&& echo "Success" \
paul@747 219
|| echo "Failed"
paul@747 220
paul@1089 221
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \
paul@1089 222
>  out7r.tmp
paul@1089 223
paul@1089 224
   ! grep -q 'event13@example.com' "out7r.tmp" \
paul@747 225
&& echo "Success" \
paul@747 226
|| echo "Failed"
paul@747 227
paul@743 228
# Check the free/busy state of the resource again.
paul@743 229
paul@655 230
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@655 231
| "$SHOWMAIL" \
paul@655 232
> out6.tmp
paul@655 233
paul@655 234
   grep -q 'METHOD:REPLY' out6.tmp \
paul@742 235
&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out6.tmp \
paul@743 236
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out6.tmp \
paul@742 237
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out6.tmp \
paul@742 238
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out6.tmp \
paul@655 239
&& echo "Success" \
paul@655 240
|| echo "Failed"