]>
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 en_US.utf
-8 en_US.utf8
22 #### Disable colorized output.
23 TERM
=dumb
; export TERM
25 expected
="$MH_TEST_DIR/test-mhical$$.expected"
26 expected_err
="$MH_TEST_DIR/test-mhical$$.expected_err"
27 actual
="$MH_TEST_DIR/test-mhical$$.actual"
28 actual_err
="$MH_TEST_DIR/test-mhical$$.actual_err"
32 cat >"$expected" <<EOF
33 Usage: mhical [switches]
35 -reply accept|decline|tentative
48 #### Skip nmh intro text.
49 run_prog mhical
-help | sed '/^$/,$d' >"$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"
98 # check display with 24 hour time format and -outfile
99 cat >"$expected" <<'EOF'
100 Summary: 4 pm meeting
101 At: Mon, 05 Jan 2015 16:00
102 To: Mon, 05 Jan 2015 16:30
105 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
111 DTSTAMP:20150101T162400Z
112 DTSTART:20150105T160000
113 DTEND:20150105T163000
120 mhical
-outfile "$MH_TEST_DIR/test1.txt" <"$MH_TEST_DIR/test1.ics"
121 check
"$expected" "$MH_TEST_DIR/test1.txt"
124 # check display with 12 hour time format and -infile
125 cat >"$expected" <<'EOF'
126 Summary: 4 pm meeting
127 At: Mon, 05 Jan 2015 4:00 PM
128 To: Mon, 05 Jan 2015 4:30 PM
131 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
137 DTSTAMP:20150101T162800Z
138 DTSTART:20150105T160000
139 DTEND:20150105T163000
146 mhical
-form mhical
.12hour
-infile "$MH_TEST_DIR/test1.ics" \
147 >"$MH_TEST_DIR/test1.txt"
148 check
"$expected" "$MH_TEST_DIR/test1.txt"
151 # check display with DST
152 cat >"$expected" <<'EOF'
157 At: Mon, 05 Jan 2015 08:00 -0500
158 To: Mon, 05 Jan 2015 09:00
162 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
165 PRODID:Microsoft Exchange Server 2010
168 TZID:Eastern Standard Time
170 DTSTART:16010101T020000
173 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
176 DTSTART:16010101T020000
179 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
183 ORGANIZER;CN=Requester:MAILTO:requester@example.com
184 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Requestee
185 :MAILTO:requestee@example.com
186 DESCRIPTION;LANGUAGE=en-US:\n\n
187 SUMMARY;LANGUAGE=en-US:Big Meeting
188 DTSTART;TZID=Eastern Standard Time:20150105T080000
189 DTEND;TZID=Eastern Standard Time:20150105T090000
193 DTSTAMP:20141231T235959Z
197 LOCATION;LANGUAGE=en-US:The Office
198 X-MICROSOFT-CDO-APPT-SEQUENCE:0
199 X-MICROSOFT-CDO-OWNERAPPTID:-0123456789
200 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
201 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
202 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
203 X-MICROSOFT-CDO-IMPORTANCE:1
204 X-MICROSOFT-CDO-INSTTYPE:0
205 X-MICROSOFT-DISALLOW-COUNTER:FALSE
209 TRIGGER;RELATED=START:-PT15M
215 TZ
=EST mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
216 check
"$expected" "$MH_TEST_DIR/test1.txt"
219 # check timezone boundary at transition to daylight saving time
220 # The default mhical display format doesn't show the timezone for the
221 # To: time, but it is different than that of the At: time.
222 cat >"$expected" <<'EOF'
224 At: Sun, 09 Mar 2014 01:59 -0500
225 To: Sun, 09 Mar 2014 03:30
228 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
233 TZID:Eastern Standard Time
235 DTSTART:16010101T020000
238 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
241 DTSTART:16010101T020000
244 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
248 DTSTAMP:20150101T000000Z
249 DTSTART;TZID=Eastern Standard Time:20140309T015959
250 DTEND;TZID=Eastern Standard Time:20140309T023000
256 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
257 check
"$expected" "$MH_TEST_DIR/test1.txt"
260 # check -format, and that timezone is correct in end time
261 cat >"$expected" <<'EOF'
262 Sun, 09 Mar 2014 03:30:00 -0400
265 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
266 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
267 check
"$expected" "$MH_TEST_DIR/test1.txt"
270 # check timezone boundary at transition from daylight saving time
271 cat >"$expected" <<'EOF'
273 At: Sun, 02 Nov 2014 01:59 -0400
274 To: Sun, 02 Nov 2014 02:00
277 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
282 TZID:Eastern Standard Time
284 DTSTART:16010101T020000
287 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
290 DTSTART:16010101T020000
293 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
297 DTSTAMP:20150101T000000Z
298 DTSTART;TZID=Eastern Standard Time:20141102T015959
299 DTEND;TZID=Eastern Standard Time:20141102T020000
305 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
306 check
"$expected" "$MH_TEST_DIR/test1.txt"
309 # check -format, and that timezone is correct in end time
310 cat >"$expected" <<'EOF'
311 Sun, 02 Nov 2014 02:00:00 -0500
314 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
315 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
316 check
"$expected" "$MH_TEST_DIR/test1.txt"
319 printf 'Local-Mailbox: Requestee2 <requestee2@example.com>\n' >> "$MH"
321 # check accept of request
322 cat >"$expected" <<'EOF'
325 PRODID:nmh mhical v0.1
328 TZID:Eastern Standard Time
330 DTSTART:16010101T020000
333 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
336 DTSTART:16010101T020000
339 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
343 ORGANIZER;CN=Requester:MAILTO:requester@example.com
344 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
345 SUMMARY;LANGUAGE=en-US:Accepted: test request
346 DTSTART;TZID=Eastern Standard Time:20150105T090000
347 DTEND;TZID=Eastern Standard Time:20150105T093000
354 LOCATION;LANGUAGE=en-US:
359 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
365 TZID:Eastern Standard Time
367 DTSTART:16010101T020000
370 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
373 DTSTART:16010101T020000
376 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
380 ORGANIZER;CN=Requester:MAILTO:requester@example.com
381 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
382 :MAILTO:requestee1@example.com
383 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
384 :MAILTO:requestee2@example.com
385 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
386 :MAILTO:requestee3@example.com
387 SUMMARY;LANGUAGE=en-US:test request
388 DTSTART;TZID=Eastern Standard Time:20150105T090000
389 DTEND;TZID=Eastern Standard Time:20150105T093000
393 DTSTAMP:20150101T171600Z
397 LOCATION;LANGUAGE=en-US:
401 TRIGGER;RELATED=START:-PT15M
407 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
408 >"$MH_TEST_DIR/test1.txt"
409 check
"$expected" "$MH_TEST_DIR/test1.txt"
411 # check accept of multiple vevent requests in single vcalendar
412 cat >"$expected" <<'EOF'
415 PRODID:nmh mhical v0.1
418 TZID:Eastern Standard Time
420 DTSTART:16010101T020000
423 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
426 DTSTART:16010101T020000
429 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
433 ORGANIZER;CN=Requester:MAILTO:requester@example.com
434 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
435 SUMMARY;LANGUAGE=en-US:Accepted: test request
436 DTSTART;TZID=Eastern Standard Time:20150105T090000
437 DTEND;TZID=Eastern Standard Time:20150105T093000
444 LOCATION;LANGUAGE=en-US:
448 ORGANIZER;CN=Requester:MAILTO:requester@example.com
449 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
450 SUMMARY;LANGUAGE=en-US:Accepted: test request
451 DTSTART;TZID=Eastern Standard Time:20150105T130000
452 DTEND;TZID=Eastern Standard Time:20150105T134500
459 LOCATION;LANGUAGE=en-US:
464 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
471 TZID:Eastern Standard Time
473 DTSTART:16010101T020000
476 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
479 DTSTART:16010101T020000
482 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
487 ORGANIZER;CN=Requester:MAILTO:requester@example.com
488 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
489 :MAILTO:requestee1@example.com
490 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
491 :MAILTO:requestee2@example.com
492 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
493 :MAILTO:requestee3@example.com
494 SUMMARY;LANGUAGE=en-US:test request
495 DTSTART;TZID=Eastern Standard Time:20150105T090000
496 DTEND;TZID=Eastern Standard Time:20150105T093000
500 DTSTAMP:20150101T171600Z
504 LOCATION;LANGUAGE=en-US:
508 TRIGGER;RELATED=START:-PT15M
513 ORGANIZER;CN=Requester:MAILTO:requester@example.com
514 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
515 :MAILTO:requestee2@example.com
516 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
517 :MAILTO:requestee3@example.com
518 SUMMARY;LANGUAGE=en-US:test request
519 DTSTART;TZID=Eastern Standard Time:20150105T130000
520 DTEND;TZID=Eastern Standard Time:20150105T134500
524 DTSTAMP:20150101T171600Z
528 LOCATION;LANGUAGE=en-US:
532 TRIGGER;RELATED=START:-PT15M
539 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
540 >"$MH_TEST_DIR/test1.txt"
541 check
"$expected" "$MH_TEST_DIR/test1.txt"
544 # check decline of request
545 cat >"$expected" <<'EOF'
548 PRODID:nmh mhical v0.1
551 ORGANIZER;CN=Requester:MAILTO:requester@example.com
552 ATTENDEE;PARTSTAT=DECLINED;CN=Requestee2:MAILTO:requestee2@example.com
553 SUMMARY;LANGUAGE=en-US:Declined: test request
554 DTSTART:20150105T090000
555 DTEND:20150105T093000
562 LOCATION;LANGUAGE=en-US:
567 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
573 ORGANIZER;CN=Requester:MAILTO:requester@example.com
574 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
575 :MAILTO:requestee1@example.com
576 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
577 :MAILTO:requestee2@example.com
578 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
579 :MAILTO:requestee3@example.com
580 SUMMARY;LANGUAGE=en-US:test request
581 DTSTART:20150105T090000
582 DTEND:20150105T093000
586 DTSTAMP:20150101T171600Z
590 LOCATION;LANGUAGE=en-US:
594 TRIGGER;RELATED=START:-PT15M
600 mhical
-reply decline
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
601 >"$MH_TEST_DIR/test1.txt"
602 check
"$expected" "$MH_TEST_DIR/test1.txt"
605 # check response of tentative to request, and -nocontenttype
606 cat >"$expected" <<'EOF'
609 PRODID:nmh mhical v0.1
612 ORGANIZER;CN=Requester:MAILTO:requester@example.com
613 ATTENDEE;PARTSTAT=TENTATIVE;CN=Requestee2:MAILTO:requestee2@example.com
614 SUMMARY;LANGUAGE=en-US:Tentative: test request
615 DTSTART:20150105T090000
616 DTEND:20150105T093000
623 LOCATION;LANGUAGE=en-US:
628 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
634 ORGANIZER;CN=Requester:MAILTO:requester@example.com
635 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
636 :MAILTO:requestee1@example.com
637 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
638 :MAILTO:requestee2@example.com
639 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
640 :MAILTO:requestee3@example.com
641 SUMMARY;LANGUAGE=en-US:test request
642 DTSTART:20150105T090000
643 DTEND:20150105T093000
647 DTSTAMP:20150101T171600Z
651 LOCATION;LANGUAGE=en-US:
655 TRIGGER;RELATED=START:-PT15M
661 mhical
-reply tentative
-contenttype -nocontenttype \
662 -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
663 >"$MH_TEST_DIR/test1.txt"
664 check
"$expected" "$MH_TEST_DIR/test1.txt"
667 # check cancel request, and -contenttype
668 cat >"$expected" <<'EOF'
669 Content-Type: text/calendar; method="CANCEL"; charset="UTF-8"
673 PRODID:nmh mhical v0.1
676 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
677 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
678 :MAILTO:requestee1@example.com
679 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
680 :MAILTO:requestee3@example.com
681 SUMMARY;LANGUAGE=en-US:Cancelled:test request
682 DTSTART:20150105T090000
683 DTEND:20150105T093000
690 LOCATION;LANGUAGE=en-US:
695 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
701 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
702 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
703 :MAILTO:requestee1@example.com
704 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
705 :MAILTO:requestee3@example.com
706 SUMMARY;LANGUAGE=en-US:test request
707 DTSTART:20150105T090000
708 DTEND:20150105T093000
712 DTSTAMP:20150101T171600Z
716 LOCATION;LANGUAGE=en-US:
720 TRIGGER;RELATED=START:-PT15M
726 mhical
-cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
727 >"$MH_TEST_DIR/test1.txt"
728 check
"$expected" "$MH_TEST_DIR/test1.txt"
731 # Check TZID name wrapped with quotes, this used to cause a segfault.
732 cat >"$expected" <<'EOF'
734 Summary: Quoted timezone ID
735 At: Wed, 01 Jan 2014 00:00
736 To: Wed, 01 Jan 2014 01:00
739 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
741 PRODID:Zimbra-Calendar-Provider
744 SUMMARY:Quoted timezone ID
748 DTSTART:19710101T000000
755 DTSTART:20140101T000000
756 DTEND;TZID="Etc/GMT":20140101T010000
762 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
763 check
"$expected" "$MH_TEST_DIR/test1.txt"
766 # Check start datetime without a time, and missing end datetime.
767 cat >"$expected" <<'EOF'
769 Summary: Test datetime without time
770 At: Wed, 30 Dec 2015 00:00
771 To: Wed, 30 Dec 2015 23:59
774 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
777 PRODID:icalendar-ruby
781 DTSTAMP:20151208T204350Z
783 DTSTART;VALUE=DATE:20151230
785 SUMMARY:Test datetime without time
789 TRIGGER;RELATED=START:-PT15M
795 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
796 check
"$expected" "$MH_TEST_DIR/test1.txt"
797 rm -f "$MH_TEST_DIR/test1.ics"