imip-agent

Annotated tests/test_person_invitation_refresh.sh

787:9cf10fe21c3a
2015-09-28 Paul Boddie Separated attendee/recurrence manipulation from presentation, introducing form field dictionary updates from form period/date objects, also simplifying the processing of attendees, removing filtering operations during editing. imipweb-client-simplification
paul@688 1
#!/bin/sh
paul@688 2
paul@688 3
THIS_DIR=`dirname $0`
paul@688 4
paul@688 5
TEMPLATES="$THIS_DIR/templates"
paul@688 6
PERSON_SCRIPT="$THIS_DIR/../imip_person.py"
paul@688 7
SHOWMAIL="$THIS_DIR/../tools/showmail.py"
paul@688 8
STORE=/tmp/store
paul@688 9
STATIC=/tmp/static
paul@688 10
PREFS=/tmp/prefs
paul@688 11
ARGS="-S $STORE -P $STATIC -p $PREFS -d"
paul@688 12
USER="mailto:vincent.vole@example.com"
paul@688 13
SENDER="mailto:paul.boddie@example.com"
paul@688 14
FBFILE="$STORE/$USER/freebusy"
paul@688 15
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@688 16
FBSENDERFILE="$STORE/$SENDER/freebusy"
paul@688 17
TAB=`printf '\t'`
paul@688 18
paul@688 19
OUTGOING_SCRIPT="$THIS_DIR/../imip_person_outgoing.py"
paul@688 20
paul@688 21
PYTHONPATH="$THIS_DIR/.."
paul@688 22
export PYTHONPATH
paul@688 23
paul@688 24
ACCEPT_SCRIPT="$THIS_DIR/test_handle.py"
paul@688 25
ACCEPT_ARGS="accept $STORE"
paul@688 26
paul@688 27
DECLINE_SCRIPT="$THIS_DIR/test_handle.py"
paul@688 28
DECLINE_ARGS="decline $STORE"
paul@688 29
paul@688 30
ERROR=err.tmp
paul@688 31
paul@688 32
rm -r $STORE
paul@688 33
rm -r $STATIC
paul@688 34
rm -r $PREFS
paul@688 35
rm $ERROR
paul@688 36
rm out*.tmp
paul@688 37
paul@688 38
mkdir -p "$PREFS/$USER"
paul@688 39
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@688 40
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@688 41
paul@688 42
mkdir -p "$PREFS/$SENDER"
paul@688 43
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@688 44
echo 'always' > "$PREFS/$SENDER/event_refreshing"
paul@688 45
paul@688 46
# Publish an event, testing registration in the outgoing handler.
paul@688 47
paul@688 48
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
paul@688 49
paul@688 50
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
paul@688 51
&& echo "Success" \
paul@688 52
|| echo "Failed"
paul@688 53
paul@688 54
# Test a request from an attendee for the event details to be refreshed.
paul@688 55
paul@688 56
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@688 57
| "$SHOWMAIL" \
paul@688 58
> out2.tmp
paul@688 59
paul@688 60
   grep -q 'METHOD:REQUEST' out2.tmp \
paul@688 61
&& echo "Success" \
paul@688 62
|| echo "Failed"
paul@688 63
paul@688 64
# Present the result to the recipient.
paul@688 65
paul@688 66
  "$PERSON_SCRIPT" $ARGS < out2.tmp 2>> $ERROR \
paul@688 67
| "$SHOWMAIL" \
paul@688 68
> out3.tmp
paul@688 69
paul@688 70
   ! grep -q 'METHOD:REPLY' out3.tmp \
paul@688 71
&& echo "Success" \
paul@688 72
|| echo "Failed"
paul@688 73
paul@708 74
   ! [ -e "$FBFILE" ] \
paul@708 75
|| ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@688 76
&& echo "Success" \
paul@688 77
|| echo "Failed"
paul@688 78
paul@688 79
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
paul@688 80
&& echo "Success" \
paul@688 81
|| echo "Failed"
paul@688 82
paul@688 83
# Test acceptance and registration in the outgoing handler.
paul@688 84
paul@688 85
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
paul@688 86
| tee out4.tmp \
paul@688 87
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@688 88
paul@688 89
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@688 90
&& echo "Success" \
paul@688 91
|| echo "Failed"
paul@688 92
paul@688 93
# Test a request from a non-attendee for the event details to be refreshed.
paul@688 94
paul@688 95
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring-non-attendee.txt" 2>> $ERROR \
paul@688 96
| "$SHOWMAIL" \
paul@688 97
> out5.tmp
paul@688 98
paul@688 99
   ! grep -q 'METHOD:REQUEST' out5.tmp \
paul@688 100
&& echo "Success" \
paul@688 101
|| echo "Failed"
paul@691 102
paul@691 103
# Test rescheduling in the outgoing handler.
paul@691 104
paul@691 105
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring-reschedule-instance.txt" 2>> $ERROR
paul@691 106
paul@691 107
   grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \
paul@691 108
&& ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \
paul@691 109
&& echo "Success" \
paul@691 110
|| echo "Failed"
paul@691 111
paul@691 112
# Test another request from an attendee for the event details to be refreshed.
paul@691 113
paul@691 114
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@691 115
| "$SHOWMAIL" \
paul@691 116
> out6.tmp
paul@691 117
paul@691 118
   grep -q 'METHOD:REQUEST' out6.tmp \
paul@691 119
&& grep -q 'RECURRENCE-ID' out6.tmp \
paul@691 120
&& [ `grep 'BEGIN:VEVENT' out6.tmp | wc -l` = '2' ] \
paul@691 121
&& echo "Success" \
paul@691 122
|| echo "Failed"
paul@691 123
paul@694 124
# Cancel a recurrence. Both the original and rescheduled recurrences should be
paul@694 125
# absent from the free/busy collection.
paul@691 126
paul@691 127
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-cancel-person-recurring-rescheduled-instance.txt" 2>> $ERROR
paul@691 128
paul@694 129
   ! grep -q "^20141010T080000Z${TAB}20141010T090000Z" "$FBSENDERFILE" \
paul@694 130
&& ! grep -q "^20141011T080000Z${TAB}20141011T090000Z" "$FBSENDERFILE" \
paul@691 131
&& echo "Success" \
paul@691 132
|| echo "Failed"
paul@691 133
paul@691 134
# Test another request from an attendee for the event details to be refreshed.
paul@691 135
# The additional recurrence should now be absent.
paul@691 136
paul@691 137
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-refresh-person-recurring.txt" 2>> $ERROR \
paul@691 138
| "$SHOWMAIL" \
paul@691 139
> out7.tmp
paul@691 140
paul@691 141
   grep -q 'METHOD:REQUEST' out7.tmp \
paul@691 142
&& ! grep -q 'RECURRENCE-ID' out7.tmp \
paul@691 143
&& [ `grep 'BEGIN:VEVENT' out7.tmp | wc -l` = '1' ] \
paul@691 144
&& echo "Success" \
paul@691 145
|| echo "Failed"