imip-agent

tests/test_resource_invitation_constraints_quota_recurring.sh

1272:65e999dd88f0
2017-09-18 Paul Boddie Added a convenience method for loading objects. Added docstrings. client-editing-simplification
     1 #!/bin/sh     2      3 . "`dirname \"$0\"`/common.sh"     4      5 USER="mailto:resource-car-porsche911@example.com"     6 SENDER="mailto:paul.boddie@example.com"     7 QUOTA="$USER"     8      9 mkdir -p "$PREFS/$USER"    10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    11 echo 'share' > "$PREFS/$USER/freebusy_sharing"    12 cat > "$PREFS/$USER/scheduling_function" <<EOF    13 schedule_in_freebusy    14 check_quota    15 EOF    16     17 # Employ a user-specific quota (no argument with the functions above).    18     19 cat <<EOF | "$SET_QUOTA_LIMITS" "$QUOTA" $SET_QUOTA_LIMITS_ARGS    20 * PT10H    21 EOF    22     23   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-car-all.txt" 2>> $ERROR \    24 | "$SHOWMAIL" \    25 > out0.tmp    26     27    grep -q 'METHOD:REPLY' out0.tmp \    28 && ! grep -q '^FREEBUSY' out0.tmp \    29 && echo "Success" \    30 || echo "Failed"    31     32 # Attempt to schedule an event.    33     34 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR    35     36    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    37 >  out0f.tmp    38     39    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out0f.tmp" \    40 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out0f.tmp" \    41 && echo "Success" \    42 || echo "Failed"    43     44 # Present the request to the resource.    45     46   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-car-recurring.txt" 2>> $ERROR \    47 | tee out1r.tmp \    48 | "$SHOWMAIL" \    49 > out1.tmp    50     51    grep -q 'METHOD:REPLY' out1.tmp \    52 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out1.tmp \    53 && echo "Success" \    54 || echo "Failed"    55     56    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    57 >  out1f.tmp    58     59    ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1f.tmp" \    60 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1f.tmp" \    61 && echo "Success" \    62 || echo "Failed"    63     64 # Check the quota (event is not confirmed).    65     66    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \    67 >  out1e.tmp    68     69    ! grep -q "event24@example.com" "out1e.tmp" \    70 && echo "Success" \    71 || echo "Failed"    72     73 # Modify the event and attempt to schedule it again.    74     75   sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \    76 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR    77     78    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    79 >  out1s.tmp    80     81    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out1s.tmp" \    82 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out1s.tmp" \    83 && grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out1s.tmp" \    84 && echo "Success" \    85 || echo "Failed"    86     87 # Present the request to the resource.    88     89   sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=11/;' "$TEMPLATES/event-request-car-recurring.txt" \    90 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \    91 | tee out2r.tmp \    92 | "$SHOWMAIL" \    93 > out2.tmp    94     95    grep -q 'METHOD:REPLY' out2.tmp \    96 && grep -q 'ATTENDEE.*;PARTSTAT=DECLINED' out2.tmp \    97 && echo "Success" \    98 || echo "Failed"    99    100    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   101 >  out2f.tmp   102    103    ! grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2f.tmp" \   104 && ! grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out2f.tmp" \   105 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2f.tmp"  \   106 && echo "Success" \   107 || echo "Failed"   108    109 # Check the quota (event is confirmed).   110    111    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \   112 >  out2e.tmp   113    114    ! grep -q "event24@example.com" "out2e.tmp" \   115 && echo "Success" \   116 || echo "Failed"   117    118 # Modify the event and attempt to schedule it again.   119    120   sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \   121 | "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR   122    123    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \   124 >  out2s.tmp   125    126    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out2s.tmp" \   127 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out2s.tmp" \   128 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out2s.tmp" \   129 && echo "Success" \   130 || echo "Failed"   131    132 # Present the request to the resource.   133    134   sed 's/FREQ=DAILY/FREQ=DAILY;COUNT=10/;' "$TEMPLATES/event-request-car-recurring.txt" \   135 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \   136 | tee out3r.tmp \   137 | "$SHOWMAIL" \   138 > out3.tmp   139    140    grep -q 'METHOD:REPLY' out3.tmp \   141 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out3.tmp \   142 && echo "Success" \   143 || echo "Failed"   144    145    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   146 >  out3f.tmp   147    148    grep -q "^20141126T150000Z${TAB}20141126T160000Z" "out3f.tmp" \   149 && grep -q "^20141205T150000Z${TAB}20141205T160000Z" "out3f.tmp" \   150 && ! grep -q "^20141206T150000Z${TAB}20141206T160000Z" "out3f.tmp" \   151 && echo "Success" \   152 || echo "Failed"   153    154 # Check the quota (event is confirmed).   155    156    "$LIST_SCRIPT" $LIST_ARGS "$QUOTA" "entries" "$SENDER" \   157 >  out3e.tmp   158    159    grep -q "event24@example.com" "out3e.tmp" \   160 && echo "Success" \   161 || echo "Failed"