]>
diplodocus.org Git - nmh/blob - test/mhical/test-mhical
2 ######################################################
6 ######################################################
10 if test -z "${MH_OBJ_DIR}"; then
11 srcdir
=`dirname $0`/..
/..
12 MH_OBJ_DIR
=`cd $srcdir && pwd`; export MH_OBJ_DIR
15 .
"${MH_OBJ_DIR}/test/common.sh"
19 #### Make sure that html-to-text conversion is what we expect.
20 require_locale en_US.utf
-8 en_US.utf8
21 LC_ALL
=en_US.UTF
-8; export LC_ALL
23 #### Disable colorized output.
24 TERM
=dumb
; export TERM
26 expected
="$MH_TEST_DIR/test-mhical$$.expected"
27 expected_err
="$MH_TEST_DIR/test-mhical$$.expected_err"
28 actual
="$MH_TEST_DIR/test-mhical$$.actual"
29 actual_err
="$MH_TEST_DIR/test-mhical$$.actual_err"
33 cat >"$expected" <<EOF
34 Usage: mhical [switches]
36 -reply accept|decline|tentative
49 run_prog mhical
-help >"$actual" 2>&1
50 check
"$expected" "$actual"
54 case `mhical -version` in
56 *) printf '%s: mhical -version generated unexpected output\n' "$0" >&2
57 failed
=`expr ${failed:-0} + 1`;;
61 # check display with timezone that only has standard time
62 cat >"$expected" <<'EOF'
64 Description: See Santa here first!
65 At: Wed, 24 Dec 2014 12:00 +0000
66 To: Fri, 25 Dec 2015 11:59
69 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
77 DTSTART:16010101T020000
84 DTSTAMP:20141224T140426Z
85 DTSTART;TZID=MHT-12:20141225T000000
86 DTEND;TZID=MHT-12:20151225T235959
88 DESCRIPTION: See Santa here first!
94 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
95 check
"$expected" "$MH_TEST_DIR/test1.txt"
96 rm -f "$MH_TEST_DIR/test1.ics"
99 # check display with 24 hour time format and -outfile
100 cat >"$expected" <<'EOF'
101 Summary: 4 pm meeting
102 At: Mon, 05 Jan 2015 16:00
103 To: Mon, 05 Jan 2015 16:30
106 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
112 DTSTAMP:20150101T162400Z
113 DTSTART:20150105T160000
114 DTEND:20150105T163000
121 mhical
-outfile "$MH_TEST_DIR/test1.txt" <"$MH_TEST_DIR/test1.ics"
122 check
"$expected" "$MH_TEST_DIR/test1.txt"
123 rm -f "$MH_TEST_DIR/test1.ics"
126 # check display with 12 hour time format and -infile
127 cat >"$expected" <<'EOF'
128 Summary: 4 pm meeting
129 At: Mon, 05 Jan 2015 4:00 PM
130 To: Mon, 05 Jan 2015 4:30 PM
133 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
139 DTSTAMP:20150101T162800Z
140 DTSTART:20150105T160000
141 DTEND:20150105T163000
148 mhical
-form mhical
.12hour
-infile "$MH_TEST_DIR/test1.ics" \
149 >"$MH_TEST_DIR/test1.txt"
150 check
"$expected" "$MH_TEST_DIR/test1.txt"
151 rm -f "$MH_TEST_DIR/test1.ics"
154 # check display with DST
155 cat >"$expected" <<'EOF'
160 At: Mon, 05 Jan 2015 08:00 -0500
161 To: Mon, 05 Jan 2015 09:00
165 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
168 PRODID:Microsoft Exchange Server 2010
171 TZID:Eastern Standard Time
173 DTSTART:16010101T020000
176 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
179 DTSTART:16010101T020000
182 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
186 ORGANIZER;CN=Requester:MAILTO:requester@example.com
187 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Requestee
188 :MAILTO:requestee@example.com
189 DESCRIPTION;LANGUAGE=en-US:\n\n
190 SUMMARY;LANGUAGE=en-US:Big Meeting
191 DTSTART;TZID=Eastern Standard Time:20150105T080000
192 DTEND;TZID=Eastern Standard Time:20150105T090000
196 DTSTAMP:20141231T235959Z
200 LOCATION;LANGUAGE=en-US:The Office
201 X-MICROSOFT-CDO-APPT-SEQUENCE:0
202 X-MICROSOFT-CDO-OWNERAPPTID:-0123456789
203 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
204 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
205 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
206 X-MICROSOFT-CDO-IMPORTANCE:1
207 X-MICROSOFT-CDO-INSTTYPE:0
208 X-MICROSOFT-DISALLOW-COUNTER:FALSE
212 TRIGGER;RELATED=START:-PT15M
218 TZ
=EST mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
219 check
"$expected" "$MH_TEST_DIR/test1.txt"
220 rm -f "$MH_TEST_DIR/test1.ics"
223 # check timezone boundary at transition to daylight saving time
224 # The default mhical display format doesn't show the timezone for the
225 # To: time, but it is different than that of the At: time.
226 cat >"$expected" <<'EOF'
228 At: Sun, 09 Mar 2014 01:59 -0500
229 To: Sun, 09 Mar 2014 03:30
232 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
237 TZID:Eastern Standard Time
239 DTSTART:16010101T020000
242 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
245 DTSTART:16010101T020000
248 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
252 DTSTAMP:20150101T000000Z
253 DTSTART;TZID=Eastern Standard Time:20140309T015959
254 DTEND;TZID=Eastern Standard Time:20140309T023000
260 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
261 check
"$expected" "$MH_TEST_DIR/test1.txt"
264 # check -format, and that timezone is correct in end time
265 cat >"$expected" <<'EOF'
266 Sun, 09 Mar 2014 03:30:00 -0400
269 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
270 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
271 check
"$expected" "$MH_TEST_DIR/test1.txt"
272 rm -f "$MH_TEST_DIR/test1.ics"
275 # check timezone boundary at transition from daylight saving time
276 cat >"$expected" <<'EOF'
278 At: Sun, 02 Nov 2014 01:59 -0400
279 To: Sun, 02 Nov 2014 02:00
282 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
287 TZID:Eastern Standard Time
289 DTSTART:16010101T020000
292 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
295 DTSTART:16010101T020000
298 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
302 DTSTAMP:20150101T000000Z
303 DTSTART;TZID=Eastern Standard Time:20141102T015959
304 DTEND;TZID=Eastern Standard Time:20141102T020000
310 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
311 check
"$expected" "$MH_TEST_DIR/test1.txt"
314 # check -format, and that timezone is correct in end time
315 cat >"$expected" <<'EOF'
316 Sun, 02 Nov 2014 02:00:00 -0500
319 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
320 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
321 check
"$expected" "$MH_TEST_DIR/test1.txt"
322 rm -f "$MH_TEST_DIR/test1.ics"
325 printf 'Local-Mailbox: Requestee2 <requestee2@example.com>\n' >> "$MH"
327 # check accept of request
328 cat >"$expected" <<'EOF'
331 PRODID:nmh mhical v0.1
334 TZID:Eastern Standard Time
336 DTSTART:16010101T020000
339 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
342 DTSTART:16010101T020000
345 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
349 ORGANIZER;CN=Requester:MAILTO:requester@example.com
350 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
351 SUMMARY;LANGUAGE=en-US:Accepted: test request
352 DTSTART;TZID=Eastern Standard Time:20150105T090000
353 DTEND;TZID=Eastern Standard Time:20150105T093000
360 LOCATION;LANGUAGE=en-US:
365 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
371 TZID:Eastern Standard Time
373 DTSTART:16010101T020000
376 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
379 DTSTART:16010101T020000
382 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
386 ORGANIZER;CN=Requester:MAILTO:requester@example.com
387 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
388 :MAILTO:requestee1@example.com
389 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
390 :MAILTO:requestee2@example.com
391 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
392 :MAILTO:requestee3@example.com
393 SUMMARY;LANGUAGE=en-US:test request
394 DTSTART;TZID=Eastern Standard Time:20150105T090000
395 DTEND;TZID=Eastern Standard Time:20150105T093000
399 DTSTAMP:20150101T171600Z
403 LOCATION;LANGUAGE=en-US:
407 TRIGGER;RELATED=START:-PT15M
413 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
414 >"$MH_TEST_DIR/test1.txt"
415 check
"$expected" "$MH_TEST_DIR/test1.txt"
416 rm -f "$MH_TEST_DIR/test1.ics"
418 # check accept of multiple vevent requests in single vcalendar
419 cat >"$expected" <<'EOF'
422 PRODID:nmh mhical v0.1
425 TZID:Eastern Standard Time
427 DTSTART:16010101T020000
430 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
433 DTSTART:16010101T020000
436 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
440 ORGANIZER;CN=Requester:MAILTO:requester@example.com
441 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
442 SUMMARY;LANGUAGE=en-US:Accepted: test request
443 DTSTART;TZID=Eastern Standard Time:20150105T090000
444 DTEND;TZID=Eastern Standard Time:20150105T093000
451 LOCATION;LANGUAGE=en-US:
455 ORGANIZER;CN=Requester:MAILTO:requester@example.com
456 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
457 SUMMARY;LANGUAGE=en-US:Accepted: test request
458 DTSTART;TZID=Eastern Standard Time:20150105T130000
459 DTEND;TZID=Eastern Standard Time:20150105T134500
466 LOCATION;LANGUAGE=en-US:
471 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
478 TZID:Eastern Standard Time
480 DTSTART:16010101T020000
483 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
486 DTSTART:16010101T020000
489 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
494 ORGANIZER;CN=Requester:MAILTO:requester@example.com
495 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
496 :MAILTO:requestee1@example.com
497 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
498 :MAILTO:requestee2@example.com
499 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
500 :MAILTO:requestee3@example.com
501 SUMMARY;LANGUAGE=en-US:test request
502 DTSTART;TZID=Eastern Standard Time:20150105T090000
503 DTEND;TZID=Eastern Standard Time:20150105T093000
507 DTSTAMP:20150101T171600Z
511 LOCATION;LANGUAGE=en-US:
515 TRIGGER;RELATED=START:-PT15M
520 ORGANIZER;CN=Requester:MAILTO:requester@example.com
521 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
522 :MAILTO:requestee2@example.com
523 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
524 :MAILTO:requestee3@example.com
525 SUMMARY;LANGUAGE=en-US:test request
526 DTSTART;TZID=Eastern Standard Time:20150105T130000
527 DTEND;TZID=Eastern Standard Time:20150105T134500
531 DTSTAMP:20150101T171600Z
535 LOCATION;LANGUAGE=en-US:
539 TRIGGER;RELATED=START:-PT15M
546 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
547 >"$MH_TEST_DIR/test1.txt"
548 check
"$expected" "$MH_TEST_DIR/test1.txt"
549 rm -f "$MH_TEST_DIR/test1.ics"
552 # check decline of request
553 cat >"$expected" <<'EOF'
556 PRODID:nmh mhical v0.1
559 ORGANIZER;CN=Requester:MAILTO:requester@example.com
560 ATTENDEE;PARTSTAT=DECLINED;CN=Requestee2:MAILTO:requestee2@example.com
561 SUMMARY;LANGUAGE=en-US:Declined: test request
562 DTSTART:20150105T090000
563 DTEND:20150105T093000
570 LOCATION;LANGUAGE=en-US:
575 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
581 ORGANIZER;CN=Requester:MAILTO:requester@example.com
582 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
583 :MAILTO:requestee1@example.com
584 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
585 :MAILTO:requestee2@example.com
586 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
587 :MAILTO:requestee3@example.com
588 SUMMARY;LANGUAGE=en-US:test request
589 DTSTART:20150105T090000
590 DTEND:20150105T093000
594 DTSTAMP:20150101T171600Z
598 LOCATION;LANGUAGE=en-US:
602 TRIGGER;RELATED=START:-PT15M
608 mhical
-reply decline
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
609 >"$MH_TEST_DIR/test1.txt"
610 check
"$expected" "$MH_TEST_DIR/test1.txt"
611 rm -f "$MH_TEST_DIR/test1.ics"
614 # check response of tentative to request, and -nocontenttype
615 cat >"$expected" <<'EOF'
618 PRODID:nmh mhical v0.1
621 ORGANIZER;CN=Requester:MAILTO:requester@example.com
622 ATTENDEE;PARTSTAT=TENTATIVE;CN=Requestee2:MAILTO:requestee2@example.com
623 SUMMARY;LANGUAGE=en-US:Tentative: test request
624 DTSTART:20150105T090000
625 DTEND:20150105T093000
632 LOCATION;LANGUAGE=en-US:
637 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
643 ORGANIZER;CN=Requester:MAILTO:requester@example.com
644 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
645 :MAILTO:requestee1@example.com
646 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
647 :MAILTO:requestee2@example.com
648 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
649 :MAILTO:requestee3@example.com
650 SUMMARY;LANGUAGE=en-US:test request
651 DTSTART:20150105T090000
652 DTEND:20150105T093000
656 DTSTAMP:20150101T171600Z
660 LOCATION;LANGUAGE=en-US:
664 TRIGGER;RELATED=START:-PT15M
670 mhical
-reply tentative
-contenttype -nocontenttype \
671 -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
672 >"$MH_TEST_DIR/test1.txt"
673 check
"$expected" "$MH_TEST_DIR/test1.txt"
674 rm -f "$MH_TEST_DIR/test1.ics"
677 # check cancel request, and -contenttype
678 cat >"$expected" <<'EOF'
679 Content-Type: text/calendar; method="CANCEL"; charset="UTF-8"
683 PRODID:nmh mhical v0.1
686 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
687 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
688 :MAILTO:requestee1@example.com
689 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
690 :MAILTO:requestee3@example.com
691 SUMMARY;LANGUAGE=en-US:Cancelled:test request
692 DTSTART:20150105T090000
693 DTEND:20150105T093000
700 LOCATION;LANGUAGE=en-US:
705 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
711 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
712 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
713 :MAILTO:requestee1@example.com
714 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
715 :MAILTO:requestee3@example.com
716 SUMMARY;LANGUAGE=en-US:test request
717 DTSTART:20150105T090000
718 DTEND:20150105T093000
722 DTSTAMP:20150101T171600Z
726 LOCATION;LANGUAGE=en-US:
730 TRIGGER;RELATED=START:-PT15M
736 mhical
-cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
737 >"$MH_TEST_DIR/test1.txt"
738 check
"$expected" "$MH_TEST_DIR/test1.txt"
739 rm -f "$MH_TEST_DIR/test1.ics"