]>
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 #### Skip nmh intro text.
50 run_prog mhical
-help | sed '/^$/,$d' >"$actual" 2>&1
51 check
"$expected" "$actual"
55 case `mhical -version` in
57 *) printf '%s: mhical -version generated unexpected output\n' "$0" >&2
58 failed
=`expr ${failed:-0} + 1`;;
62 # check display with timezone that only has standard time
63 cat >"$expected" <<'EOF'
65 Description: See Santa here first!
66 At: Wed, 24 Dec 2014 12:00 +0000
67 To: Fri, 25 Dec 2015 11:59
70 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
78 DTSTART:16010101T020000
85 DTSTAMP:20141224T140426Z
86 DTSTART;TZID=MHT-12:20141225T000000
87 DTEND;TZID=MHT-12:20151225T235959
89 DESCRIPTION: See Santa here first!
95 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
96 check
"$expected" "$MH_TEST_DIR/test1.txt"
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"
125 # check display with 12 hour time format and -infile
126 cat >"$expected" <<'EOF'
127 Summary: 4 pm meeting
128 At: Mon, 05 Jan 2015 4:00 PM
129 To: Mon, 05 Jan 2015 4:30 PM
132 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
138 DTSTAMP:20150101T162800Z
139 DTSTART:20150105T160000
140 DTEND:20150105T163000
147 mhical
-form mhical
.12hour
-infile "$MH_TEST_DIR/test1.ics" \
148 >"$MH_TEST_DIR/test1.txt"
149 check
"$expected" "$MH_TEST_DIR/test1.txt"
152 # check display with DST
153 cat >"$expected" <<'EOF'
158 At: Mon, 05 Jan 2015 08:00 -0500
159 To: Mon, 05 Jan 2015 09:00
163 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
166 PRODID:Microsoft Exchange Server 2010
169 TZID:Eastern Standard Time
171 DTSTART:16010101T020000
174 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
177 DTSTART:16010101T020000
180 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
184 ORGANIZER;CN=Requester:MAILTO:requester@example.com
185 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Requestee
186 :MAILTO:requestee@example.com
187 DESCRIPTION;LANGUAGE=en-US:\n\n
188 SUMMARY;LANGUAGE=en-US:Big Meeting
189 DTSTART;TZID=Eastern Standard Time:20150105T080000
190 DTEND;TZID=Eastern Standard Time:20150105T090000
194 DTSTAMP:20141231T235959Z
198 LOCATION;LANGUAGE=en-US:The Office
199 X-MICROSOFT-CDO-APPT-SEQUENCE:0
200 X-MICROSOFT-CDO-OWNERAPPTID:-0123456789
201 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
202 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
203 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
204 X-MICROSOFT-CDO-IMPORTANCE:1
205 X-MICROSOFT-CDO-INSTTYPE:0
206 X-MICROSOFT-DISALLOW-COUNTER:FALSE
210 TRIGGER;RELATED=START:-PT15M
216 TZ
=EST mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
217 check
"$expected" "$MH_TEST_DIR/test1.txt"
220 # check timezone boundary at transition to daylight saving time
221 # The default mhical display format doesn't show the timezone for the
222 # To: time, but it is different than that of the At: time.
223 cat >"$expected" <<'EOF'
225 At: Sun, 09 Mar 2014 01:59 -0500
226 To: Sun, 09 Mar 2014 03:30
229 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
234 TZID:Eastern Standard Time
236 DTSTART:16010101T020000
239 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
242 DTSTART:16010101T020000
245 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
249 DTSTAMP:20150101T000000Z
250 DTSTART;TZID=Eastern Standard Time:20140309T015959
251 DTEND;TZID=Eastern Standard Time:20140309T023000
257 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
258 check
"$expected" "$MH_TEST_DIR/test1.txt"
261 # check -format, and that timezone is correct in end time
262 cat >"$expected" <<'EOF'
263 Sun, 09 Mar 2014 03:30:00 -0400
266 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
267 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
268 check
"$expected" "$MH_TEST_DIR/test1.txt"
271 # check timezone boundary at transition from daylight saving time
272 cat >"$expected" <<'EOF'
274 At: Sun, 02 Nov 2014 01:59 -0400
275 To: Sun, 02 Nov 2014 02:00
278 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
283 TZID:Eastern Standard Time
285 DTSTART:16010101T020000
288 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
291 DTSTART:16010101T020000
294 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
298 DTSTAMP:20150101T000000Z
299 DTSTART;TZID=Eastern Standard Time:20141102T015959
300 DTEND;TZID=Eastern Standard Time:20141102T020000
306 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
307 check
"$expected" "$MH_TEST_DIR/test1.txt"
310 # check -format, and that timezone is correct in end time
311 cat >"$expected" <<'EOF'
312 Sun, 02 Nov 2014 02:00:00 -0500
315 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
316 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
317 check
"$expected" "$MH_TEST_DIR/test1.txt"
320 printf 'Local-Mailbox: Requestee2 <requestee2@example.com>\n' >> "$MH"
322 # check accept of request
323 cat >"$expected" <<'EOF'
326 PRODID:nmh mhical v0.1
329 TZID:Eastern Standard Time
331 DTSTART:16010101T020000
334 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
337 DTSTART:16010101T020000
340 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
344 ORGANIZER;CN=Requester:MAILTO:requester@example.com
345 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
346 SUMMARY;LANGUAGE=en-US:Accepted: test request
347 DTSTART;TZID=Eastern Standard Time:20150105T090000
348 DTEND;TZID=Eastern Standard Time:20150105T093000
355 LOCATION;LANGUAGE=en-US:
360 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
366 TZID:Eastern Standard Time
368 DTSTART:16010101T020000
371 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
374 DTSTART:16010101T020000
377 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
381 ORGANIZER;CN=Requester:MAILTO:requester@example.com
382 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
383 :MAILTO:requestee1@example.com
384 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
385 :MAILTO:requestee2@example.com
386 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
387 :MAILTO:requestee3@example.com
388 SUMMARY;LANGUAGE=en-US:test request
389 DTSTART;TZID=Eastern Standard Time:20150105T090000
390 DTEND;TZID=Eastern Standard Time:20150105T093000
394 DTSTAMP:20150101T171600Z
398 LOCATION;LANGUAGE=en-US:
402 TRIGGER;RELATED=START:-PT15M
408 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
409 >"$MH_TEST_DIR/test1.txt"
410 check
"$expected" "$MH_TEST_DIR/test1.txt"
412 # check accept of multiple vevent requests in single vcalendar
413 cat >"$expected" <<'EOF'
416 PRODID:nmh mhical v0.1
419 TZID:Eastern Standard Time
421 DTSTART:16010101T020000
424 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
427 DTSTART:16010101T020000
430 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
434 ORGANIZER;CN=Requester:MAILTO:requester@example.com
435 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
436 SUMMARY;LANGUAGE=en-US:Accepted: test request
437 DTSTART;TZID=Eastern Standard Time:20150105T090000
438 DTEND;TZID=Eastern Standard Time:20150105T093000
445 LOCATION;LANGUAGE=en-US:
449 ORGANIZER;CN=Requester:MAILTO:requester@example.com
450 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
451 SUMMARY;LANGUAGE=en-US:Accepted: test request
452 DTSTART;TZID=Eastern Standard Time:20150105T130000
453 DTEND;TZID=Eastern Standard Time:20150105T134500
460 LOCATION;LANGUAGE=en-US:
465 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
472 TZID:Eastern Standard Time
474 DTSTART:16010101T020000
477 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
480 DTSTART:16010101T020000
483 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
488 ORGANIZER;CN=Requester:MAILTO:requester@example.com
489 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
490 :MAILTO:requestee1@example.com
491 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
492 :MAILTO:requestee2@example.com
493 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
494 :MAILTO:requestee3@example.com
495 SUMMARY;LANGUAGE=en-US:test request
496 DTSTART;TZID=Eastern Standard Time:20150105T090000
497 DTEND;TZID=Eastern Standard Time:20150105T093000
501 DTSTAMP:20150101T171600Z
505 LOCATION;LANGUAGE=en-US:
509 TRIGGER;RELATED=START:-PT15M
514 ORGANIZER;CN=Requester:MAILTO:requester@example.com
515 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
516 :MAILTO:requestee2@example.com
517 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
518 :MAILTO:requestee3@example.com
519 SUMMARY;LANGUAGE=en-US:test request
520 DTSTART;TZID=Eastern Standard Time:20150105T130000
521 DTEND;TZID=Eastern Standard Time:20150105T134500
525 DTSTAMP:20150101T171600Z
529 LOCATION;LANGUAGE=en-US:
533 TRIGGER;RELATED=START:-PT15M
540 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
541 >"$MH_TEST_DIR/test1.txt"
542 check
"$expected" "$MH_TEST_DIR/test1.txt"
545 # check decline of request
546 cat >"$expected" <<'EOF'
549 PRODID:nmh mhical v0.1
552 ORGANIZER;CN=Requester:MAILTO:requester@example.com
553 ATTENDEE;PARTSTAT=DECLINED;CN=Requestee2:MAILTO:requestee2@example.com
554 SUMMARY;LANGUAGE=en-US:Declined: test request
555 DTSTART:20150105T090000
556 DTEND:20150105T093000
563 LOCATION;LANGUAGE=en-US:
568 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
574 ORGANIZER;CN=Requester:MAILTO:requester@example.com
575 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
576 :MAILTO:requestee1@example.com
577 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
578 :MAILTO:requestee2@example.com
579 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
580 :MAILTO:requestee3@example.com
581 SUMMARY;LANGUAGE=en-US:test request
582 DTSTART:20150105T090000
583 DTEND:20150105T093000
587 DTSTAMP:20150101T171600Z
591 LOCATION;LANGUAGE=en-US:
595 TRIGGER;RELATED=START:-PT15M
601 mhical
-reply decline
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
602 >"$MH_TEST_DIR/test1.txt"
603 check
"$expected" "$MH_TEST_DIR/test1.txt"
606 # check response of tentative to request, and -nocontenttype
607 cat >"$expected" <<'EOF'
610 PRODID:nmh mhical v0.1
613 ORGANIZER;CN=Requester:MAILTO:requester@example.com
614 ATTENDEE;PARTSTAT=TENTATIVE;CN=Requestee2:MAILTO:requestee2@example.com
615 SUMMARY;LANGUAGE=en-US:Tentative: test request
616 DTSTART:20150105T090000
617 DTEND:20150105T093000
624 LOCATION;LANGUAGE=en-US:
629 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
635 ORGANIZER;CN=Requester:MAILTO:requester@example.com
636 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
637 :MAILTO:requestee1@example.com
638 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
639 :MAILTO:requestee2@example.com
640 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
641 :MAILTO:requestee3@example.com
642 SUMMARY;LANGUAGE=en-US:test request
643 DTSTART:20150105T090000
644 DTEND:20150105T093000
648 DTSTAMP:20150101T171600Z
652 LOCATION;LANGUAGE=en-US:
656 TRIGGER;RELATED=START:-PT15M
662 mhical
-reply tentative
-contenttype -nocontenttype \
663 -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
664 >"$MH_TEST_DIR/test1.txt"
665 check
"$expected" "$MH_TEST_DIR/test1.txt"
668 # check cancel request, and -contenttype
669 cat >"$expected" <<'EOF'
670 Content-Type: text/calendar; method="CANCEL"; charset="UTF-8"
674 PRODID:nmh mhical v0.1
677 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
678 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
679 :MAILTO:requestee1@example.com
680 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
681 :MAILTO:requestee3@example.com
682 SUMMARY;LANGUAGE=en-US:Cancelled:test request
683 DTSTART:20150105T090000
684 DTEND:20150105T093000
691 LOCATION;LANGUAGE=en-US:
696 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
702 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
703 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
704 :MAILTO:requestee1@example.com
705 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
706 :MAILTO:requestee3@example.com
707 SUMMARY;LANGUAGE=en-US:test request
708 DTSTART:20150105T090000
709 DTEND:20150105T093000
713 DTSTAMP:20150101T171600Z
717 LOCATION;LANGUAGE=en-US:
721 TRIGGER;RELATED=START:-PT15M
727 mhical
-cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
728 >"$MH_TEST_DIR/test1.txt"
729 check
"$expected" "$MH_TEST_DIR/test1.txt"
732 # Check TZID name wrapped with quotes, this used to cause a segfault.
733 cat >"$expected" <<'EOF'
735 Summary: Quoted timezone ID
736 At: Wed, 01 Jan 2014 00:00
737 To: Wed, 01 Jan 2014 01:00
740 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
742 PRODID:Zimbra-Calendar-Provider
745 SUMMARY:Quoted timezone ID
749 DTSTART:19710101T000000
756 DTSTART:20140101T000000
757 DTEND;TZID="Etc/GMT":20140101T010000
763 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
764 check
"$expected" "$MH_TEST_DIR/test1.txt"
767 # Check start datetime without a time, and missing end datetime.
768 cat >"$expected" <<'EOF'
770 Summary: Test datetime without time
771 At: Wed, 30 Dec 2015 00:00
772 To: Wed, 30 Dec 2015 23:59
775 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
778 PRODID:icalendar-ruby
782 DTSTAMP:20151208T204350Z
784 DTSTART;VALUE=DATE:20151230
786 SUMMARY:Test datetime without time
790 TRIGGER;RELATED=START:-PT15M
796 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
797 check
"$expected" "$MH_TEST_DIR/test1.txt"
798 rm -f "$MH_TEST_DIR/test1.ics"