imip-agent

Annotated tests/test_resource_invitation_constraints_multiple.sh

1069:37921ab84c01
2016-03-06 Paul Boddie Moved imip_store into a new imiptools.stores package as the file module.
paul@1028 1
#!/bin/sh
paul@1028 2
paul@1028 3
. "`dirname \"$0\"`/common.sh"
paul@1028 4
paul@1028 5
USER="mailto:resource-room-sauna@example.com"
paul@1031 6
SENDER="mailto:paul.boddie@example.com"
paul@1031 7
OUTSIDESENDER="mailto:paul.boddie@example.net"
paul@1028 8
FBFILE="$STORE/$USER/freebusy"
paul@1028 9
FBSENDERFILE="$STORE/$SENDER/freebusy"
paul@1031 10
FBOUTSIDESENDERFILE="$STORE/$OUTSIDESENDER/freebusy"
paul@1028 11
paul@1028 12
mkdir -p "$PREFS/$USER"
paul@1028 13
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@1028 14
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@1028 15
cat > "$PREFS/$USER/scheduling_function" <<EOF
paul@1028 16
schedule_in_freebusy
paul@1028 17
same_domain_only
paul@1028 18
EOF
paul@1028 19
echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"
paul@1028 20
echo 'PT60S' > "$PREFS/$USER/freebusy_offers"
paul@1028 21
paul@1028 22
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@1028 23
| "$SHOWMAIL" \
paul@1028 24
> out0.tmp
paul@1028 25
paul@1028 26
   grep -q 'METHOD:REPLY' out0.tmp \
paul@1028 27
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@1028 28
&& echo "Success" \
paul@1028 29
|| echo "Failed"
paul@1028 30
paul@1028 31
# Attempt to schedule an event.
paul@1028 32
paul@1028 33
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR
paul@1028 34
paul@1031 35
   grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBOUTSIDESENDERFILE" \
paul@1028 36
&& echo "Success" \
paul@1028 37
|| echo "Failed"
paul@1028 38
paul@1028 39
# Present the request to the resource.
paul@1028 40
paul@1028 41
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \
paul@1028 42
| tee out1r.tmp \
paul@1028 43
| "$SHOWMAIL" \
paul@1028 44
> out1.tmp
paul@1028 45
paul@1028 46
   grep -q 'METHOD:REPLY' out1.tmp \
paul@1028 47
&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \
paul@1028 48
&& echo "Success" \
paul@1028 49
|| echo "Failed"
paul@1028 50
paul@1028 51
   ! [ -e "$FBFILE" ] \
paul@1028 52
|| ! grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \
paul@1028 53
&& echo "Success" \
paul@1028 54
|| echo "Failed"
paul@1028 55
paul@1028 56
# Relax the scheduling function.
paul@1028 57
paul@1028 58
cat > "$PREFS/$USER/scheduling_function" <<EOF
paul@1028 59
schedule_in_freebusy
paul@1028 60
EOF
paul@1028 61
paul@1028 62
# Present the request to the resource.
paul@1028 63
paul@1028 64
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-outsider.txt" 2>> $ERROR \
paul@1028 65
| tee out2r.tmp \
paul@1028 66
| "$SHOWMAIL" \
paul@1028 67
> out2.tmp
paul@1028 68
paul@1028 69
   grep -q 'METHOD:REPLY' out2.tmp \
paul@1028 70
&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \
paul@1028 71
&& echo "Success" \
paul@1028 72
|| echo "Failed"
paul@1028 73
paul@1028 74
   [ -e "$FBFILE" ] \
paul@1028 75
&& grep -q "^20141126T150000Z${TAB}20141126T154500Z" "$FBFILE" \
paul@1028 76
&& echo "Success" \
paul@1028 77
|| echo "Failed"
paul@1028 78
paul@1028 79
# Check the free/busy state of the resource again.
paul@1028 80
paul@1028 81
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@1028 82
| "$SHOWMAIL" \
paul@1028 83
> out3.tmp
paul@1028 84
paul@1028 85
   grep -q 'METHOD:REPLY' out3.tmp \
paul@1028 86
&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T154500Z' out3.tmp \
paul@1028 87
&& echo "Success" \
paul@1028 88
|| echo "Failed"
paul@1031 89
paul@1031 90
# Try a different scheduling function.
paul@1031 91
paul@1031 92
ACL="$PWD/acl.tmp"
paul@1031 93
paul@1031 94
cat > "$PREFS/$USER/scheduling_function" <<EOF
paul@1031 95
schedule_in_freebusy
paul@1031 96
access_control_list "$ACL"
paul@1031 97
EOF
paul@1031 98
paul@1031 99
# Try without an ACL.
paul@1031 100
paul@1031 101
cat > "$ACL" <<EOF
paul@1031 102
EOF
paul@1031 103
paul@1031 104
# Attempt to schedule an event.
paul@1031 105
paul@1031 106
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR
paul@1031 107
paul@1031 108
   grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBSENDERFILE" \
paul@1031 109
&& echo "Success" \
paul@1031 110
|| echo "Failed"
paul@1031 111
paul@1031 112
# Present the request to the resource.
paul@1031 113
paul@1031 114
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \
paul@1031 115
| tee out4r.tmp \
paul@1031 116
| "$SHOWMAIL" \
paul@1031 117
> out4.tmp
paul@1031 118
paul@1031 119
   grep -q 'METHOD:REPLY' out4.tmp \
paul@1031 120
&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out4.tmp \
paul@1031 121
&& echo "Success" \
paul@1031 122
|| echo "Failed"
paul@1031 123
paul@1031 124
   ! [ -e "$FBFILE" ] \
paul@1031 125
|| ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBFILE" \
paul@1031 126
&& echo "Success" \
paul@1031 127
|| echo "Failed"
paul@1031 128
paul@1031 129
# Try with an unreasonable ACL.
paul@1031 130
paul@1031 131
cat > "$ACL" <<EOF
paul@1031 132
decline
paul@1031 133
EOF
paul@1031 134
paul@1031 135
# Attempt to schedule an event.
paul@1031 136
paul@1031 137
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR
paul@1031 138
paul@1031 139
   grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBSENDERFILE" \
paul@1031 140
&& echo "Success" \
paul@1031 141
|| echo "Failed"
paul@1031 142
paul@1031 143
# Present the request to the resource.
paul@1031 144
paul@1031 145
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \
paul@1031 146
| tee out5r.tmp \
paul@1031 147
| "$SHOWMAIL" \
paul@1031 148
> out5.tmp
paul@1031 149
paul@1031 150
   grep -q 'METHOD:REPLY' out5.tmp \
paul@1031 151
&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out5.tmp \
paul@1031 152
&& echo "Success" \
paul@1031 153
|| echo "Failed"
paul@1031 154
paul@1031 155
   ! [ -e "$FBFILE" ] \
paul@1031 156
|| ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBFILE" \
paul@1031 157
&& echo "Success" \
paul@1031 158
|| echo "Failed"
paul@1031 159
paul@1031 160
# Try with a reasonable ACL.
paul@1031 161
paul@1031 162
cat > "$ACL" <<EOF
paul@1031 163
accept
paul@1031 164
decline attendee simon.skunk@example.com
paul@1031 165
EOF
paul@1031 166
paul@1031 167
# Attempt to schedule an event.
paul@1031 168
paul@1031 169
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR
paul@1031 170
paul@1031 171
   grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBSENDERFILE" \
paul@1031 172
&& echo "Success" \
paul@1031 173
|| echo "Failed"
paul@1031 174
paul@1031 175
# Present the request to the resource.
paul@1031 176
paul@1031 177
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \
paul@1031 178
| tee out6r.tmp \
paul@1031 179
| "$SHOWMAIL" \
paul@1031 180
> out6.tmp
paul@1031 181
paul@1031 182
   grep -q 'METHOD:REPLY' out6.tmp \
paul@1031 183
&& grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out6.tmp \
paul@1031 184
&& echo "Success" \
paul@1031 185
|| echo "Failed"
paul@1031 186
paul@1031 187
   ! [ -e "$FBFILE" ] \
paul@1031 188
|| ! grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBFILE" \
paul@1031 189
&& echo "Success" \
paul@1031 190
|| echo "Failed"
paul@1031 191
paul@1031 192
# Modify the ACL, using the implicit preference setting to hold the list.
paul@1031 193
paul@1031 194
cat > "$PREFS/$USER/scheduling_function" <<EOF
paul@1031 195
schedule_in_freebusy
paul@1031 196
access_control_list
paul@1031 197
EOF
paul@1031 198
paul@1031 199
cat > "$PREFS/$USER/acl" <<EOF
paul@1031 200
accept
paul@1031 201
decline attendee simon.skunk@example.com
paul@1031 202
accept organiser mailto:paul.boddie@example.com
paul@1031 203
EOF
paul@1031 204
paul@1031 205
# Present the request to the resource.
paul@1031 206
paul@1031 207
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-acl.txt" 2>> $ERROR \
paul@1031 208
| tee out7r.tmp \
paul@1031 209
| "$SHOWMAIL" \
paul@1031 210
> out7.tmp
paul@1031 211
paul@1031 212
   grep -q 'METHOD:REPLY' out7.tmp \
paul@1031 213
&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out7.tmp \
paul@1031 214
&& echo "Success" \
paul@1031 215
|| echo "Failed"
paul@1031 216
paul@1031 217
   ! [ -e "$FBFILE" ] \
paul@1031 218
|| grep -q "^20141126T160000Z${TAB}20141126T164500Z" "$FBFILE" \
paul@1031 219
&& echo "Success" \
paul@1031 220
|| echo "Failed"
paul@1031 221
paul@1031 222
rm "$ACL"