imip-agent

tests/test_resource_invitation_constraints_alternative.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-room-sauna@example.com"     6 SENDER="mailto:paul.boddie@example.com"     7 RIVALSENDER="mailto:vincent.vole@example.com"     8      9 mkdir -p "$PREFS/$USER"    10 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    11 echo 'share' > "$PREFS/$USER/freebusy_sharing"    12 echo 'schedule_corrected_in_freebusy' > "$PREFS/$USER/scheduling_function"    13 echo '10,12,14,16,18:0,15,30,45' > "$PREFS/$USER/permitted_times"    14 echo 'PT60S' > "$PREFS/$USER/freebusy_offers"    15     16   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \    17 | "$SHOWMAIL" \    18 > out0.tmp    19     20    grep -q 'METHOD:REPLY' out0.tmp \    21 && ! grep -q '^FREEBUSY' out0.tmp \    22 && echo "Success" \    23 || echo "Failed"    24     25 # Attempt to schedule an event.    26     27 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR    28     29    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy" \    30 |  tee out0f.tmp \    31 |  grep -q "^20141126T151000Z${TAB}20141126T154500Z" \    32 && echo "Success" \    33 || echo "Failed"    34     35 # Present the request to the resource.    36     37   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-bad.txt" 2>> $ERROR \    38 | tee out1r.tmp \    39 | "$SHOWMAIL" \    40 > out1.tmp    41     42    grep -q 'METHOD:COUNTER' out1.tmp \    43 && grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' out1.tmp \    44 && echo "Success" \    45 || echo "Failed"    46     47    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \    48 >  out1f.tmp    49     50    ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out1f.tmp" \    51 && echo "Success" \    52 || echo "Failed"    53     54    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \    55 |  tee out1o.tmp \    56 |  grep -q "^20141126T151500Z${TAB}20141126T154500Z" \    57 && echo "Success" \    58 || echo "Failed"    59     60 # Present the response to the organiser.    61     62   "$PERSON_SCRIPT" $ARGS < out1r.tmp 2>> $ERROR \    63 | tee out2r.tmp \    64 | "$SHOWMAIL" \    65 > out2.tmp    66     67    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "freebusy_other" "$USER" \    68 >  out2f.tmp    69     70    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out2f.tmp" \    71 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out2f.tmp"  \    72 && echo "Success" \    73 || echo "Failed"    74     75    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "object" "event13@example.com" \    76 |  tee out2O.tmp \    77 |  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161000' \    78 && echo "Success" \    79 || echo "Failed"    80     81    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "countered_object" "event13@example.com" "$USER" \    82 |  tee out2C.tmp \    83 |  grep -q 'DTSTART;TZID=Europe/Oslo.*:20141126T161500' \    84 && echo "Success" \    85 || echo "Failed"    86     87    "$LIST_SCRIPT" $LIST_ARGS "$SENDER" "requests" \    88 |  tee out2R.tmp \    89 |  grep -q 'event13@example.com' \    90 && echo "Success" \    91 || echo "Failed"    92     93 # Decline the counter-proposal.    94     95   sed 's/COUNTER/DECLINECOUNTER/' < out1.tmp \    96 | sed 's/^From: calendar/To: resource-room-sauna/' \    97 | sed 's/^To: paul.boddie/From: paul.boddie/' \    98 > out3.tmp    99    100 "$OUTGOING_SCRIPT" $ARGS < out3.tmp 2>> $ERROR   101    102   "$RESOURCE_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \   103 | tee out4r.tmp \   104 | "$SHOWMAIL" \   105 > out4.tmp   106    107    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   108 >  out4f.tmp   109    110    ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out4f.tmp" \   111 && echo "Success" \   112 || echo "Failed"   113    114    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   115 >  out4o.tmp   116    117    ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out4o.tmp" \   118 && echo "Success" \   119 || echo "Failed"   120    121 # Attempt to schedule an event in the proposed period.   122    123 "$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR   124    125    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \   126 >  out4r.tmp   127    128    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out4r.tmp" \   129 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out4r.tmp" \   130 && echo "Success" \   131 || echo "Failed"   132    133 # Present the request to the resource.   134    135   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-sauna-rival.txt" 2>> $ERROR \   136 | tee out5r.tmp \   137 | "$SHOWMAIL" \   138 > out5.tmp   139    140    grep -q 'METHOD:REPLY' out5.tmp \   141 && grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' out5.tmp \   142 && echo "Success" \   143 || echo "Failed"   144    145    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy" \   146 |  tee out5f.tmp \   147 |  grep -q "^20141126T153000Z${TAB}20141126T154500Z" \   148 && echo "Success" \   149 || echo "Failed"   150    151    "$LIST_SCRIPT" $LIST_ARGS "$USER" "freebusy_offers" \   152 >  out5o.tmp   153    154    ! grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out5o.tmp" \   155 && echo "Success" \   156 || echo "Failed"   157    158 # Present the response to the organiser.   159    160   "$PERSON_SCRIPT" $ARGS < out5r.tmp 2>> $ERROR \   161 | tee out6r.tmp \   162 | "$SHOWMAIL" \   163 > out6.tmp   164    165    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "freebusy" \   166 >  out6R.tmp   167    168    ! grep -q "^20141126T151000Z${TAB}20141126T154500Z" "out6R.tmp" \   169 && ! grep -q "^20141126T151500Z${TAB}20141126T154500Z" "out6R.tmp" \   170 && grep -q "^20141126T153000Z${TAB}20141126T154500Z" "out6R.tmp" \   171 && echo "Success" \   172 || echo "Failed"   173    174    "$LIST_SCRIPT" $LIST_ARGS "$RIVALSENDER" "object" "event18@example.com" \   175 |  tee out6O.tmp \   176 |  grep -q 'ATTENDEE.*;PARTSTAT=ACCEPTED' \   177 && echo "Success" \   178 || echo "Failed"   179    180 # Check the free/busy state of the resource so far.   181    182   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-sauna-all.txt" 2>> $ERROR \   183 | "$SHOWMAIL" \   184 > out7.tmp   185    186    grep -q 'METHOD:REPLY' out7.tmp \   187 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151000Z/20141126T154500Z' out7.tmp \   188 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T154500Z' out7.tmp \   189 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T154500Z' out7.tmp \   190 && echo "Success" \   191 || echo "Failed"