imip-agent

tests/test_resource_invitation_imposter.sh

789:c90e7281106d
2015-09-29 Paul Boddie Added missing escaping for text within elements.
     1 #!/bin/sh     2      3 THIS_DIR=`dirname $0`     4      5 TEMPLATES="$THIS_DIR/templates"     6 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"     7 SHOWMAIL="$THIS_DIR/../tools/showmail.py"     8 STORE=/tmp/store     9 STATIC=/tmp/static    10 PREFS=/tmp/prefs    11 ARGS="-S $STORE -P $STATIC -p $PREFS -d"    12 USER="mailto:resource-room-confroom@example.com"    13 ERROR=err.tmp    14     15 rm -r $STORE    16 rm -r $STATIC    17 rm -r $PREFS    18 rm $ERROR    19 rm out*.tmp    20     21 mkdir -p "$PREFS/$USER"    22 echo 'Europe/Oslo' > "$PREFS/$USER/TZID"    23 echo 'share' > "$PREFS/$USER/freebusy_sharing"    24 echo 'never' > "$PREFS/$USER/organiser_replacement"    25     26   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request-all.txt" 2>> $ERROR \    27 | "$SHOWMAIL" \    28 > out0.tmp    29     30    grep -q 'METHOD:REPLY' out0.tmp \    31 && ! grep -q '^FREEBUSY' out0.tmp \    32 && echo "Success" \    33 || echo "Failed"    34     35   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \    36 | "$SHOWMAIL" \    37 > out1.tmp    38     39    grep -q 'METHOD:REPLY' out1.tmp \    40 && ! grep -q '^FREEBUSY' out1.tmp \    41 && echo "Success" \    42 || echo "Failed"    43     44   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request.txt" 2>> $ERROR \    45 | "$SHOWMAIL" \    46 > out2.tmp    47     48    grep -q 'METHOD:REPLY' out2.tmp \    49 && grep -q 'ATTENDEE;PARTSTAT=ACCEPTED' out2.tmp \    50 && echo "Success" \    51 || echo "Failed"    52     53   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \    54 | "$SHOWMAIL" \    55 > out3.tmp    56     57    grep -q 'METHOD:REPLY' out3.tmp \    58 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out3.tmp \    59 && echo "Success" \    60 || echo "Failed"    61     62 # Try to change to an unrecognised organiser.    63     64   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \    65 | "$SHOWMAIL" \    66 > out4.tmp    67     68    ! grep -q 'METHOD:REPLY' out4.tmp \    69 && echo "Success" \    70 || echo "Failed"    71     72   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \    73 | "$SHOWMAIL" \    74 > out5.tmp    75     76    grep -q 'METHOD:REPLY' out5.tmp \    77 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out5.tmp \    78 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out5.tmp \    79 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out5.tmp \    80 && echo "Success" \    81 || echo "Failed"    82     83 # Try to change to an attendee as organiser.    84     85   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \    86 | "$SHOWMAIL" \    87 > out6.tmp    88     89    ! grep -q 'METHOD:REPLY' out6.tmp \    90 && echo "Success" \    91 || echo "Failed"    92     93   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \    94 | "$SHOWMAIL" \    95 > out7.tmp    96     97    grep -q 'METHOD:REPLY' out7.tmp \    98 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out7.tmp \    99 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out7.tmp \   100 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out7.tmp \   101 && echo "Success" \   102 || echo "Failed"   103    104 # Change the policy.   105    106 echo 'attendee' > "$PREFS/$USER/organiser_replacement"   107    108 # Try to change to an attendee as organiser.   109    110   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \   111 | "$SHOWMAIL" \   112 > out8.tmp   113    114    grep -q 'METHOD:REPLY' out8.tmp \   115 && echo "Success" \   116 || echo "Failed"   117    118   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \   119 | "$SHOWMAIL" \   120 > out9.tmp   121    122    grep -q 'METHOD:REPLY' out9.tmp \   123 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out9.tmp \   124 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out9.tmp \   125 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out9.tmp \   126 && echo "Success" \   127 || echo "Failed"   128    129 # Try to change to an unrecognised organiser.   130    131   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \   132 | "$SHOWMAIL" \   133 > out10.tmp   134    135    ! grep -q 'METHOD:REPLY' out10.tmp \   136 && echo "Success" \   137 || echo "Failed"   138    139   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \   140 | "$SHOWMAIL" \   141 > out11.tmp   142    143    grep -q 'METHOD:REPLY' out11.tmp \   144 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out11.tmp \   145 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out11.tmp \   146 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out11.tmp \   147 && echo "Success" \   148 || echo "Failed"   149    150 # Change the policy.   151    152 echo 'any' > "$PREFS/$USER/organiser_replacement"   153    154 # Try to change to an unrecognised organiser.   155    156   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter.txt" 2>> $ERROR \   157 | "$SHOWMAIL" \   158 > out12.tmp   159    160    grep -q 'METHOD:REPLY' out12.tmp \   161 && echo "Success" \   162 || echo "Failed"   163    164   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \   165 | "$SHOWMAIL" \   166 > out13.tmp   167    168    grep -q 'METHOD:REPLY' out13.tmp \   169 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out13.tmp \   170 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out13.tmp \   171 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out13.tmp \   172 && echo "Success" \   173 || echo "Failed"   174    175 # Try to change to an attendee as organiser.   176    177   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/event-request-imposter-attendee.txt" 2>> $ERROR \   178 | "$SHOWMAIL" \   179 > out14.tmp   180    181    grep -q 'METHOD:REPLY' out14.tmp \   182 && echo "Success" \   183 || echo "Failed"   184    185   "$RESOURCE_SCRIPT" $ARGS < "$TEMPLATES/fb-request.txt" 2>> $ERROR \   186 | "$SHOWMAIL" \   187 > out15.tmp   188    189    grep -q 'METHOD:REPLY' out15.tmp \   190 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T150000Z/20141126T160000Z' out15.tmp \   191 && ! grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T153000Z/20141126T160000Z' out15.tmp \   192 && grep -q 'FREEBUSY;FBTYPE=BUSY:20141126T151500Z/20141126T160000Z' out15.tmp \   193 && echo "Success" \   194 || echo "Failed"