imip-agent

Annotated tests/test_resource_invitation_constraints_alternative.sh

1410:17c085e01ee0
2017-12-03 Paul Boddie Fixed inclusive (UNTIL) selection to avoid non-final selectors causing duplicate selection of values. Removed the 'first' attribute from all but the Pattern selector since it is only relevant to that selector's behaviour. client-editing-simplification
paul@746 1
#!/bin/sh
paul@746 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@746 4
paul@746 5
USER="mailto:resource-room-sauna@example.com"
paul@746 6
SENDER="mailto:paul.boddie@example.com"
paul@746 7
RIVALSENDER="mailto:vincent.vole@example.com"
paul@746 8
paul@746 9
mkdir -p "$PREFS/$USER"
paul@746 10
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@746 11
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@938 12
echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"
paul@746 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@746 15
paul@746 16
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@746 17
| "$SHOWMAIL" \
paul@746 18
> out0.tmp
paul@746 19
paul@746 20
   grep -q 'METHOD:REPLY' out0.tmp \
paul@746 21
&& ! grep -q '^FREEBUSY' out0.tmp \
paul@746 22
&& echo "Success" \
paul@746 23
|| echo "Failed"
paul@746 24
paul@746 25
# Attempt to schedule an event.
paul@746 26
paul@746 27
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR
paul@746 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@746 32
&& echo "Success" \
paul@746 33
|| echo "Failed"
paul@746 34
paul@746 35
# Present the request to the resource.
paul@746 36
paul@746 37
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \
paul@1153 38
| tee out1r.tmp \
paul@746 39
| "$SHOWMAIL" \
paul@746 40
> out1.tmp
paul@746 41
paul@746 42
   grep -q 'METHOD:COUNTER' out1.tmp \
paul@746 43
&& grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \
paul@746 44
&& echo "Success" \
paul@746 45
|| echo "Failed"
paul@746 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@746 51
&& echo "Success" \
paul@746 52
|| echo "Failed"
paul@746 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@746 57
&& echo "Success" \
paul@746 58
|| echo "Failed"
paul@746 59
paul@746 60
# Present the response to the organiser.
paul@746 61
paul@1153 62
  "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \
paul@746 63
| tee out2r.tmp \
paul@746 64
| "$SHOWMAIL" \
paul@746 65
> out2.tmp
paul@746 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@1089 71
&& ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out2f.tmp"  \
paul@746 72
&& echo "Success" \
paul@746 73
|| echo "Failed"
paul@746 74
paul@1089 75
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event13@example.com" \
paul@1089 76
|  tee out2O.tmp \
paul@1089 77
|  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' \
paul@747 78
&& echo "Success" \
paul@747 79
|| echo "Failed"
paul@747 80
paul@1089 81
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \
paul@1089 82
|  tee out2C.tmp \
paul@1089 83
|  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' \
paul@747 84
&& echo "Success" \
paul@747 85
|| echo "Failed"
paul@747 86
paul@1089 87
   "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \
paul@1089 88
|  tee out2R.tmp \
paul@1089 89
|  grep -q 'event13@example.com' \
paul@746 90
&& echo "Success" \
paul@746 91
|| echo "Failed"
paul@746 92
paul@746 93
# Decline the counter-proposal.
paul@746 94
paul@746 95
  sed 's/COUNTER/DECLINECOUNTER/' < out1.tmp \
paul@746 96
| sed 's/^From: calendar/To: resource-room-sauna/' \
paul@746 97
| sed 's/^To: paul.boddie/From: paul.boddie/' \
paul@746 98
> out3.tmp
paul@746 99
paul@746 100
"$OUTGOING_SCRIPT" $ARGS < out3.tmp 2>> $ERROR
paul@746 101
paul@746 102
  "$RESOURCE_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
paul@1153 103
| tee out4r.tmp \
paul@746 104
| "$SHOWMAIL" \
paul@746 105
> out4.tmp
paul@746 106
paul@1089 107
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 108
>  out4f.tmp
paul@1089 109
paul@1089 110
   ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out4f.tmp" \
paul@746 111
&& echo "Success" \
paul@746 112
|| echo "Failed"
paul@746 113
paul@1089 114
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
paul@1089 115
>  out4o.tmp
paul@1089 116
paul@1089 117
   ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out4o.tmp" \
paul@746 118
&& echo "Success" \
paul@746 119
|| echo "Failed"
paul@746 120
paul@746 121
# Attempt to schedule an event in the proposed period.
paul@746 122
paul@746 123
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR
paul@746 124
paul@1089 125
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \
paul@1089 126
>  out4r.tmp
paul@1089 127
paul@1089 128
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out4r.tmp" \
paul@1089 129
&& grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out4r.tmp" \
paul@746 130
&& echo "Success" \
paul@746 131
|| echo "Failed"
paul@746 132
paul@746 133
# Present the request to the resource.
paul@746 134
paul@746 135
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \
paul@1153 136
| tee out5r.tmp \
paul@746 137
| "$SHOWMAIL" \
paul@746 138
> out5.tmp
paul@746 139
paul@746 140
   grep -q 'METHOD:REPLY' out5.tmp \
paul@746 141
&& grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out5.tmp \
paul@746 142
&& echo "Success" \
paul@746 143
|| echo "Failed"
paul@746 144
paul@1089 145
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \
paul@1089 146
|  tee out5f.tmp \
paul@1089 147
|  grep -q "^20141126T153000Z${TAB}20141126T154500Z" \
paul@746 148
&& echo "Success" \
paul@746 149
|| echo "Failed"
paul@746 150
paul@1089 151
   "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \
paul@1089 152
>  out5o.tmp
paul@1089 153
paul@1089 154
   ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out5o.tmp" \
paul@746 155
&& echo "Success" \
paul@746 156
|| echo "Failed"
paul@746 157
paul@746 158
# Present the response to the organiser.
paul@746 159
paul@1153 160
  "$PERSON_SCRIPT" $ARGS < out5r.tmp 2>> $ERROR \
paul@1153 161
| tee out6r.tmp \
paul@746 162
| "$SHOWMAIL" \
paul@746 163
> out6.tmp
paul@746 164
paul@1089 165
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \
paul@1153 166
>  out6R.tmp
paul@1089 167
paul@1153 168
   ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out6R.tmp" \
paul@1153 169
&& ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out6R.tmp" \
paul@1153 170
&& grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out6R.tmp" \
paul@746 171
&& echo "Success" \
paul@746 172
|| echo "Failed"
paul@746 173
paul@1089 174
   "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "object" "event18@example.com" \
paul@1089 175
|  tee out6O.tmp \
paul@1089 176
|  grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' \
paul@746 177
&& echo "Success" \
paul@746 178
|| echo "Failed"
paul@746 179
paul@746 180
# Check the free/busy state of the resource so far.
paul@746 181
paul@746 182
  "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \
paul@746 183
| "$SHOWMAIL" \
paul@746 184
> out7.tmp
paul@746 185
paul@746 186
   grep -q 'METHOD:REPLY' out7.tmp \
paul@746 187
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out7.tmp \
paul@746 188
&& ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out7.tmp \
paul@746 189
&& grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out7.tmp \
paul@746 190
&& echo "Success" \
paul@746 191
|| echo "Failed"