imip-agent

tests/test_resource_invitation_constraints_quota_recurring_unlimited.sh

1434:857aae8d5942
2018-01-12 Paul Boddie Override frequency qualifiers incompatible with yearday selectors. Added support for serialising selectors, producing RRULE-compatible output. client-editing-simplification
     1 #!/bin/sh     2      3 . "`dirname \"$0\"`/common.sh"     4      5 USER1="mailto:resource-car-porsche911@example.com"     6 USER2="mailto:resource-car-fiat500@example.com"     7 SENDER1="mailto:paul.boddie@example.com"     8 SENDERADDRESS1="paul.boddie@example.com"     9 QUOTA=cars    10     11 # Test quota enforcement on two resources, first checking whether the resources    12 # can schedule an incoming reservation, then checking whether the reservation    13 # would exceed the organiser's quota applying collectively to both resources.    14     15 # The result should be the first scheduling attempt being declined because it    16 # attempts to reserve an indefinite amount of time that obviously exceeds the    17 # quota, with the second attempt succeeding once the quota has been removed.    18     19 # The event is then cancelled for one resource and the effect evaluated.    20     21 mkdir -p "$PREFS/$USER1"    22 echo 'Europe/Oslo' > "$PREFS/$USER1/TZID"    23 echo 'share' > "$PREFS/$USER1/freebusy_sharing"    24 cat > "$PREFS/$USER1/scheduling_function" <<EOF    25 schedule_in_freebusy    26 check_quota $QUOTA    27 EOF    28 echo '20141010' > "$PREFS/$USER1/window_start"    29     30 mkdir -p "$PREFS/$USER2"    31 echo 'Europe/Oslo' > "$PREFS/$USER2/TZID"    32 echo 'share' > "$PREFS/$USER2/freebusy_sharing"    33 cat > "$PREFS/$USER2/scheduling_function" <<EOF    34 schedule_in_freebusy    35 check_quota $QUOTA    36 EOF    37 echo '20141010' > "$PREFS/$USER2/window_start"    38     39 cat <<EOF | "$SET_QUOTA_LIMITS" "$QUOTA" $SET_QUOTA_LIMITS_ARGS    40 * PT10H    41 EOF    42     43 # Allow cars to delegate to each other. This defines the possible attendees for    44 # recurring events.    45     46 cat <<EOF | "$SET_DELEGATES" "$QUOTA" $SET_DELEGATES_ARGS    47 mailto:resource-car-porsche911@example.com    48 mailto:resource-car-fiat500@example.com    49 EOF    50     51   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-car-all.txt" 2>> $ERROR \    52 | "$SHOWMAIL" \    53 > out0.tmp    54     55    grep -q 'METHOD:REPLY' out0.tmp \    56 && ! grep -q '^FREEBUSY' out0.tmp \    57 && echo "Success" \    58 || echo "Failed"    59     60 # Attempt to schedule an event.    61     62 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR    63     64    "$LIST_SCRIPT" $LIST_ARGS "$SENDER1" "freebusy" \    65 >  out0f.tmp    66     67    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0f.tmp" \    68 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out0f.tmp" \    69 && echo "Success" \    70 || echo "Failed"    71     72 # Present the request to the resource.    73     74   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR \    75 | tee out1r.tmp \    76 | "$SHOWMAIL" \    77 > out1.tmp    78     79    grep -q 'METHOD:REPLY' out1.tmp \    80 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \    81 && echo "Success" \    82 || echo "Failed"    83     84    "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \    85 >  out1f.tmp    86     87    "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \    88 >  out1f2.tmp    89     90    ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1f.tmp" \    91 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1f.tmp" \    92 && ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1f2.tmp" \    93 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1f2.tmp" \    94 && echo "Success" \    95 || echo "Failed"    96     97 # Check the quota (event is not confirmed).    98     99    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER1" \   100 >  out1e.tmp   101    102    ! grep -q "event25@example.com" "out1e.tmp" \   103 && echo "Success" \   104 || echo "Failed"   105    106 # Modify the quota and attempt to schedule the event again.   107    108 cat <<EOF | "$SET_QUOTA_LIMITS" "$QUOTA" $SET_QUOTA_LIMITS_ARGS   109 * *   110 EOF   111    112 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR   113    114    "$LIST_SCRIPT" $LIST_ARGS "$SENDER1" "freebusy" \   115 >  out1s.tmp   116    117    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1s.tmp" \   118 && grep -q "^20141130T150000Z${TAB}20141130T160000Z" "out1s.tmp" \   119 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1s.tmp" \   120 && echo "Success" \   121 || echo "Failed"   122    123 # Present the request to the resource.   124    125   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-cars-recurring.txt" 2>> $ERROR \   126 | tee out2r.tmp \   127 | "$SHOWMAIL" \   128 > out2.tmp   129    130 # Since the email module used by showmail.py cannot stop after reading a single   131 # message, the second message is obtained.   132    133   "$SHOWMAIL" 1 < out2r.tmp \   134 >> out2.tmp   135    136    grep -q 'METHOD:REPLY' out2.tmp \   137 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \   138 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out2.tmp \   139 && echo "Success" \   140 || echo "Failed"   141    142    "$LIST_SCRIPT" $LIST_ARGS "$USER1" "freebusy" \   143 >  out2f.tmp   144    145    "$LIST_SCRIPT" $LIST_ARGS "$USER2" "freebusy" \   146 >  out2f2.tmp   147    148    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \   149 && grep -q "^20141130T150000Z${TAB}20141130T160000Z" "out2f.tmp" \   150 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2f.tmp" \   151 && grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f2.tmp" \   152 && grep -q "^20141130T150000Z${TAB}20141130T160000Z" "out2f2.tmp" \   153 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2f2.tmp" \   154 && echo "Success" \   155 || echo "Failed"   156    157 # Check the quota (event is confirmed for both resources).   158    159    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER1" \   160 >  out2e.tmp   161    162    grep -q "event25@example.com" "out2e.tmp" \   163 && grep -q "$USER1" "out2e.tmp" \   164 && grep -q "$USER2" "out2e.tmp" \   165 && echo "Success" \   166 || echo "Failed"   167    168 # Check the journal's event store.   169    170    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_object" "event25@example.com" \   171 >  out2o.tmp   172    173    grep -q "event25@example.com" "out2o.tmp" \   174 && grep -q "$USER1" "out2o.tmp" \   175 && grep -q "$USER2" "out2o.tmp" \   176 && echo "Success" \   177 || echo "Failed"   178    179 # Run the free/busy maintenance script and check that the event provides   180 # recurrences.   181    182 "$FREEBUSY_SCRIPT" "$QUOTA" '*' $FREEBUSY_QUOTA_ARGS $ARGS 2>> $ERROR   183    184    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_freebusy_providers" \   185 |  tee out2p.tmp \   186 |  grep -q 'event25@example.com' \   187 && echo "Success" \   188 || echo "Failed"   189    190 # Cancel the event for one of the resources.   191    192   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-car-recurring.txt" 2>> $ERROR   193 echo "Cancel..."   194    195 # Check the quota (event is confirmed for one resource).   196    197    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER1" \   198 >  out3e.tmp   199    200    grep -q "event25@example.com" "out3e.tmp" \   201 && grep -q "$USER1" "out3e.tmp" \   202 && ! grep -q "$USER2" "out3e.tmp" \   203 && echo "Success" \   204 || echo "Failed"   205    206 # Check the journal's event store.   207    208    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_object" "event25@example.com" \   209 >  out3o.tmp   210    211    grep -q "event25@example.com" "out3o.tmp" \   212 && grep -q "$USER1" "out3o.tmp" \   213 && ! grep -q "$USER2" "out3o.tmp" \   214 && echo "Success" \   215 || echo "Failed"   216    217 # Run the free/busy maintenance script and check that the event still provides   218 # recurrences.   219    220 "$FREEBUSY_SCRIPT" "$QUOTA" '*' $FREEBUSY_QUOTA_ARGS $ARGS 2>> $ERROR   221    222    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_freebusy_providers" \   223 |  tee out3p.tmp \   224 |  grep -q 'event25@example.com' \   225 && echo "Success" \   226 || echo "Failed"   227    228 # Cancel the event completely.   229    230   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-cars-recurring.txt" 2>> $ERROR   231 echo "Cancel..."   232    233 # Check the quota (event is confirmed for no resources).   234    235    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER1" \   236 >  out4e.tmp   237    238    ! grep -q "event25@example.com" "out4e.tmp" \   239 && ! grep -q "$USER1" "out4e.tmp" \   240 && ! grep -q "$USER2" "out4e.tmp" \   241 && echo "Success" \   242 || echo "Failed"   243    244 # Check the journal's event store.   245    246    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_object" "event25@example.com" \   247 >  out4o.tmp   248    249    ! grep -q "event25@example.com" "out4o.tmp" \   250 && ! grep -q "$USER1" "out4o.tmp" \   251 && ! grep -q "$USER2" "out4o.tmp" \   252 && echo "Success" \   253 || echo "Failed"   254    255 # Run the free/busy maintenance script and check that the event no longer   256 # provides recurrences.   257    258 "$FREEBUSY_SCRIPT" "$QUOTA" '*' $FREEBUSY_QUOTA_ARGS $ARGS 2>> $ERROR   259    260    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "journal_freebusy_providers" \   261 >  out4p.tmp   262    263    ! grep -q 'event25@example.com' "out4p.tmp" \   264 && echo "Success" \   265 || echo "Failed"