imip-agent

Annotated tests/test_person_invitation_add.sh

1069:37921ab84c01
2016-03-06 Paul Boddie Moved imip_store into a new imiptools.stores package as the file module.
paul@734 1
#!/bin/sh
paul@734 2
paul@1024 3
. "`dirname \"$0\"`/common.sh"
paul@734 4
paul@734 5
USER="mailto:vincent.vole@example.com"
paul@734 6
SENDER="mailto:paul.boddie@example.com"
paul@734 7
FBFILE="$STORE/$USER/freebusy"
paul@734 8
FBOTHERFILE="$STORE/$USER/freebusy-other/$SENDER"
paul@734 9
FBSENDERFILE="$STORE/$SENDER/freebusy"
paul@734 10
FBSENDEROTHERFILE="$STORE/$SENDER/freebusy-other/$USER"
paul@734 11
paul@734 12
mkdir -p "$PREFS/$USER"
paul@734 13
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@734 14
echo 'share' > "$PREFS/$USER/freebusy_sharing"
paul@734 15
paul@734 16
mkdir -p "$PREFS/$SENDER"
paul@734 17
echo 'Europe/Oslo' > "$PREFS/$USER/TZID"
paul@734 18
echo 'always' > "$PREFS/$SENDER/event_refreshing"
paul@734 19
paul@734 20
# Test event request registration in the outgoing handler.
paul@734 21
paul@734 22
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR
paul@734 23
paul@734 24
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
paul@734 25
&& echo "Success" \
paul@734 26
|| echo "Failed"
paul@734 27
paul@734 28
# Present the request to the recipient.
paul@734 29
paul@734 30
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-request-person-recurring.txt" 2>> $ERROR \
paul@734 31
| "$SHOWMAIL" \
paul@734 32
> out2.tmp
paul@734 33
paul@734 34
   ! grep -q 'METHOD:REPLY' out2.tmp \
paul@734 35
&& echo "Success" \
paul@734 36
|| echo "Failed"
paul@734 37
paul@734 38
   ! [ -e "$FBFILE" ] \
paul@734 39
|| ! grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@734 40
&& echo "Success" \
paul@734 41
|| echo "Failed"
paul@734 42
paul@734 43
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
paul@734 44
&& echo "Success" \
paul@734 45
|| echo "Failed"
paul@734 46
paul@734 47
# Test acceptance and registration in the outgoing handler.
paul@734 48
paul@734 49
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
paul@734 50
| tee out3.tmp \
paul@734 51
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@734 52
paul@734 53
   "$SHOWMAIL" < out3.tmp | grep -q 'METHOD:REPLY' \
paul@734 54
&& echo "Success" \
paul@734 55
|| echo "Failed"
paul@734 56
paul@734 57
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@734 58
&& echo "Success" \
paul@734 59
|| echo "Failed"
paul@734 60
paul@734 61
# Present the result to the recipient.
paul@734 62
paul@734 63
  "$PERSON_SCRIPT" $ARGS < out3.tmp 2>> $ERROR \
paul@734 64
| "$SHOWMAIL" \
paul@734 65
> out4.tmp
paul@734 66
paul@734 67
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDEROTHERFILE" \
paul@734 68
&& echo "Success" \
paul@734 69
|| echo "Failed"
paul@734 70
paul@734 71
# Attempt to add an occurrence to the event.
paul@734 72
paul@735 73
"$OUTGOING_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR
paul@734 74
paul@734 75
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBSENDERFILE" \
paul@734 76
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBSENDERFILE" \
paul@734 77
&& echo "Success" \
paul@734 78
|| echo "Failed"
paul@734 79
paul@734 80
# Present the request to the recipient.
paul@734 81
paul@735 82
  "$PERSON_SCRIPT" $ARGS < "$TEMPLATES/event-add-person-recurring.txt" 2>> $ERROR \
paul@734 83
| "$SHOWMAIL" \
paul@734 84
> out5.tmp
paul@734 85
paul@734 86
   grep -q 'METHOD:REFRESH' out5.tmp \
paul@734 87
&& echo "Success" \
paul@734 88
|| echo "Failed"
paul@734 89
paul@734 90
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@734 91
&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \
paul@734 92
&& echo "Success" \
paul@734 93
|| echo "Failed"
paul@734 94
paul@734 95
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
paul@866 96
&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBOTHERFILE" \
paul@734 97
&& echo "Success" \
paul@734 98
|| echo "Failed"
paul@734 99
paul@734 100
# Present the refresh message to the organiser.
paul@734 101
paul@734 102
  "$PERSON_SCRIPT" $ARGS < out5.tmp 2>> $ERROR \
paul@866 103
| tee out6r.tmp \
paul@734 104
| "$SHOWMAIL" \
paul@734 105
> out6.tmp
paul@734 106
paul@734 107
   grep -q 'METHOD:REQUEST' out6.tmp \
paul@734 108
&& echo "Success" \
paul@734 109
|| echo "Failed"
paul@734 110
paul@734 111
# Present the request to the recipient.
paul@734 112
paul@866 113
  "$PERSON_SCRIPT" $ARGS < out6r.tmp 2>> $ERROR \
paul@734 114
| "$SHOWMAIL" \
paul@734 115
> out7.tmp
paul@734 116
paul@734 117
   ! grep -q 'METHOD:REPLY' out7.tmp \
paul@734 118
&& echo "Success" \
paul@734 119
|| echo "Failed"
paul@734 120
paul@734 121
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@734 122
&& ! grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \
paul@734 123
&& echo "Success" \
paul@734 124
|| echo "Failed"
paul@734 125
paul@734 126
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBOTHERFILE" \
paul@734 127
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBOTHERFILE" \
paul@734 128
&& echo "Success" \
paul@734 129
|| echo "Failed"
paul@734 130
paul@734 131
# Test acceptance and registration in the outgoing handler.
paul@734 132
paul@734 133
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" 2>> $ERROR \
paul@734 134
| tee out8.tmp \
paul@734 135
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@734 136
paul@734 137
   "$SHOWMAIL" < out8.tmp | grep -q 'METHOD:REPLY' \
paul@734 138
&& echo "Success" \
paul@734 139
|| echo "Failed"
paul@734 140
paul@734 141
  "$ACCEPT_SCRIPT" $ACCEPT_ARGS "$USER" "event8@example.com" "20150109T090000Z" 2>> $ERROR \
paul@734 142
| tee out9.tmp \
paul@734 143
| "$OUTGOING_SCRIPT" $ARGS 2>> $ERROR
paul@734 144
paul@734 145
   "$SHOWMAIL" < out9.tmp | grep -q 'METHOD:REPLY' \
paul@734 146
&& echo "Success" \
paul@734 147
|| echo "Failed"
paul@734 148
paul@734 149
   grep -q "^20141212T090000Z${TAB}20141212T100000Z" "$FBFILE" \
paul@734 150
&& grep -q "^20150109T090000Z${TAB}20150109T100000Z" "$FBFILE" \
paul@734 151
&& echo "Success" \
paul@734 152
|| echo "Failed"