]>
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 check_exit
'-eq 1' mhical
-
21 #### Make sure that html-to-text conversion is what we expect.
22 require_locale en_US.UTF
-8 en_US.UTF8 en_US.utf
-8 en_US.utf8
24 #### Disable colorized output.
25 TERM
=dumb
; export TERM
27 expected
="$MH_TEST_DIR/test-mhical$$.expected"
28 expected_err
="$MH_TEST_DIR/test-mhical$$.expected_err"
29 actual
="$MH_TEST_DIR/test-mhical$$.actual"
30 actual_err
="$MH_TEST_DIR/test-mhical$$.actual_err"
34 cat >"$expected" <<EOF
35 Usage: mhical [switches]
37 -reply accept|decline|tentative
50 #### Skip nmh intro text.
51 run_prog mhical
-help | sed '/^$/,$d' >"$actual" 2>&1
52 check
"$expected" "$actual"
56 case `mhical -version` in
58 *) printf '%s: mhical -version generated unexpected output\n' "$0" >&2
59 failed
=`expr ${failed:-0} + 1`;;
63 # check display with timezone that only has standard time
64 cat >"$expected" <<'EOF'
66 Description: See Santa here first!
67 At: Wed, 24 Dec 2014 12:00 +0000
68 To: Fri, 25 Dec 2015 11:59
71 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
79 DTSTART:16010101T020000
86 DTSTAMP:20141224T140426Z
87 DTSTART;TZID=MHT-12:20141225T000000
88 DTEND;TZID=MHT-12:20151225T235959
90 DESCRIPTION: See Santa here first!
96 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
97 check
"$expected" "$MH_TEST_DIR/test1.txt"
100 # check display with 24 hour time format and -outfile
101 cat >"$expected" <<'EOF'
102 Summary: 4 pm meeting
103 At: Mon, 05 Jan 2015 16:00
104 To: Mon, 05 Jan 2015 16:30
107 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
113 DTSTAMP:20150101T162400Z
114 DTSTART:20150105T160000
115 DTEND:20150105T163000
122 mhical
-outfile "$MH_TEST_DIR/test1.txt" <"$MH_TEST_DIR/test1.ics"
123 check
"$expected" "$MH_TEST_DIR/test1.txt"
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"
153 # check display with DST
154 cat >"$expected" <<'EOF'
159 At: Mon, 05 Jan 2015 08:00 -0500
160 To: Mon, 05 Jan 2015 09:00
164 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
167 PRODID:Microsoft Exchange Server 2010
170 TZID:Eastern Standard Time
172 DTSTART:16010101T020000
175 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
178 DTSTART:16010101T020000
181 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
185 ORGANIZER;CN=Requester:MAILTO:requester@example.com
186 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=FALSE;CN=Requestee
187 :MAILTO:requestee@example.com
188 DESCRIPTION;LANGUAGE=en-US:\n\n
189 SUMMARY;LANGUAGE=en-US:Big Meeting
190 DTSTART;TZID=Eastern Standard Time:20150105T080000
191 DTEND;TZID=Eastern Standard Time:20150105T090000
195 DTSTAMP:20141231T235959Z
199 LOCATION;LANGUAGE=en-US:The Office
200 X-MICROSOFT-CDO-APPT-SEQUENCE:0
201 X-MICROSOFT-CDO-OWNERAPPTID:-0123456789
202 X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
203 X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
204 X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
205 X-MICROSOFT-CDO-IMPORTANCE:1
206 X-MICROSOFT-CDO-INSTTYPE:0
207 X-MICROSOFT-DISALLOW-COUNTER:FALSE
211 TRIGGER;RELATED=START:-PT15M
217 TZ
=EST mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
218 check
"$expected" "$MH_TEST_DIR/test1.txt"
221 # check timezone boundary at transition to daylight saving time
222 # The default mhical display format doesn't show the timezone for the
223 # To: time, but it is different than that of the At: time.
224 cat >"$expected" <<'EOF'
226 At: Sun, 09 Mar 2014 01:59 -0500
227 To: Sun, 09 Mar 2014 03:30
230 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
235 TZID:Eastern Standard Time
237 DTSTART:16010101T020000
240 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
243 DTSTART:16010101T020000
246 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
250 DTSTAMP:20150101T000000Z
251 DTSTART;TZID=Eastern Standard Time:20140309T015959
252 DTEND;TZID=Eastern Standard Time:20140309T023000
258 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
259 check
"$expected" "$MH_TEST_DIR/test1.txt"
262 # check -format, and that timezone is correct in end time
263 cat >"$expected" <<'EOF'
264 Sun, 09 Mar 2014 03:30:00 -0400
267 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
268 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
269 check
"$expected" "$MH_TEST_DIR/test1.txt"
272 # check timezone boundary at transition from daylight saving time
273 cat >"$expected" <<'EOF'
275 At: Sun, 02 Nov 2014 01:59 -0400
276 To: Sun, 02 Nov 2014 02:00
279 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
284 TZID:Eastern Standard Time
286 DTSTART:16010101T020000
289 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
292 DTSTART:16010101T020000
295 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
299 DTSTAMP:20150101T000000Z
300 DTSTART;TZID=Eastern Standard Time:20141102T015959
301 DTEND;TZID=Eastern Standard Time:20141102T020000
307 TZ
=EST5EDT mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
308 check
"$expected" "$MH_TEST_DIR/test1.txt"
311 # check -format, and that timezone is correct in end time
312 cat >"$expected" <<'EOF'
313 Sun, 02 Nov 2014 02:00:00 -0500
316 TZ
=EST5EDT mhical
-format '%(pretty{dtend})' \
317 -infile "$MH_TEST_DIR/test1.ics" -outfile "$MH_TEST_DIR/test1.txt"
318 check
"$expected" "$MH_TEST_DIR/test1.txt"
321 printf 'Local-Mailbox: Requestee2 <requestee2@example.com>\n' >> "$MH"
323 # check accept of request
324 cat >"$expected" <<'EOF'
327 PRODID:nmh mhical v0.1
330 TZID:Eastern Standard Time
332 DTSTART:16010101T020000
335 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
338 DTSTART:16010101T020000
341 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
345 ORGANIZER;CN=Requester:MAILTO:requester@example.com
346 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
347 SUMMARY;LANGUAGE=en-US:Accepted: test request
348 DTSTART;TZID=Eastern Standard Time:20150105T090000
349 DTEND;TZID=Eastern Standard Time:20150105T093000
356 LOCATION;LANGUAGE=en-US:
361 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
367 TZID:Eastern Standard Time
369 DTSTART:16010101T020000
372 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
375 DTSTART:16010101T020000
378 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
382 ORGANIZER;CN=Requester:MAILTO:requester@example.com
383 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
384 :MAILTO:requestee1@example.com
385 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
386 :MAILTO:requestee2@example.com
387 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
388 :MAILTO:requestee3@example.com
389 SUMMARY;LANGUAGE=en-US:test request
390 DTSTART;TZID=Eastern Standard Time:20150105T090000
391 DTEND;TZID=Eastern Standard Time:20150105T093000
395 DTSTAMP:20150101T171600Z
399 LOCATION;LANGUAGE=en-US:
403 TRIGGER;RELATED=START:-PT15M
409 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
410 >"$MH_TEST_DIR/test1.txt"
411 check
"$expected" "$MH_TEST_DIR/test1.txt"
413 # check accept of multiple vevent requests in single vcalendar
414 cat >"$expected" <<'EOF'
417 PRODID:nmh mhical v0.1
420 TZID:Eastern Standard Time
422 DTSTART:16010101T020000
425 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
428 DTSTART:16010101T020000
431 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
435 ORGANIZER;CN=Requester:MAILTO:requester@example.com
436 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
437 SUMMARY;LANGUAGE=en-US:Accepted: test request
438 DTSTART;TZID=Eastern Standard Time:20150105T090000
439 DTEND;TZID=Eastern Standard Time:20150105T093000
446 LOCATION;LANGUAGE=en-US:
450 ORGANIZER;CN=Requester:MAILTO:requester@example.com
451 ATTENDEE;PARTSTAT=ACCEPTED;CN=Requestee2:MAILTO:requestee2@example.com
452 SUMMARY;LANGUAGE=en-US:Accepted: test request
453 DTSTART;TZID=Eastern Standard Time:20150105T130000
454 DTEND;TZID=Eastern Standard Time:20150105T134500
461 LOCATION;LANGUAGE=en-US:
466 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
473 TZID:Eastern Standard Time
475 DTSTART:16010101T020000
478 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
481 DTSTART:16010101T020000
484 RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
489 ORGANIZER;CN=Requester:MAILTO:requester@example.com
490 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
491 :MAILTO:requestee1@example.com
492 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
493 :MAILTO:requestee2@example.com
494 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
495 :MAILTO:requestee3@example.com
496 SUMMARY;LANGUAGE=en-US:test request
497 DTSTART;TZID=Eastern Standard Time:20150105T090000
498 DTEND;TZID=Eastern Standard Time:20150105T093000
502 DTSTAMP:20150101T171600Z
506 LOCATION;LANGUAGE=en-US:
510 TRIGGER;RELATED=START:-PT15M
515 ORGANIZER;CN=Requester:MAILTO:requester@example.com
516 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
517 :MAILTO:requestee2@example.com
518 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
519 :MAILTO:requestee3@example.com
520 SUMMARY;LANGUAGE=en-US:test request
521 DTSTART;TZID=Eastern Standard Time:20150105T130000
522 DTEND;TZID=Eastern Standard Time:20150105T134500
526 DTSTAMP:20150101T171600Z
530 LOCATION;LANGUAGE=en-US:
534 TRIGGER;RELATED=START:-PT15M
541 mhical
-reply accept
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
542 >"$MH_TEST_DIR/test1.txt"
543 check
"$expected" "$MH_TEST_DIR/test1.txt"
546 # check decline of request
547 cat >"$expected" <<'EOF'
550 PRODID:nmh mhical v0.1
553 ORGANIZER;CN=Requester:MAILTO:requester@example.com
554 ATTENDEE;PARTSTAT=DECLINED;CN=Requestee2:MAILTO:requestee2@example.com
555 SUMMARY;LANGUAGE=en-US:Declined: test request
556 DTSTART:20150105T090000
557 DTEND:20150105T093000
564 LOCATION;LANGUAGE=en-US:
569 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
575 ORGANIZER;CN=Requester:MAILTO:requester@example.com
576 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
577 :MAILTO:requestee1@example.com
578 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
579 :MAILTO:requestee2@example.com
580 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
581 :MAILTO:requestee3@example.com
582 SUMMARY;LANGUAGE=en-US:test request
583 DTSTART:20150105T090000
584 DTEND:20150105T093000
588 DTSTAMP:20150101T171600Z
592 LOCATION;LANGUAGE=en-US:
596 TRIGGER;RELATED=START:-PT15M
602 mhical
-reply decline
<"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
603 >"$MH_TEST_DIR/test1.txt"
604 check
"$expected" "$MH_TEST_DIR/test1.txt"
607 # check response of tentative to request, and -nocontenttype
608 cat >"$expected" <<'EOF'
611 PRODID:nmh mhical v0.1
614 ORGANIZER;CN=Requester:MAILTO:requester@example.com
615 ATTENDEE;PARTSTAT=TENTATIVE;CN=Requestee2:MAILTO:requestee2@example.com
616 SUMMARY;LANGUAGE=en-US:Tentative: test request
617 DTSTART:20150105T090000
618 DTEND:20150105T093000
625 LOCATION;LANGUAGE=en-US:
630 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
636 ORGANIZER;CN=Requester:MAILTO:requester@example.com
637 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
638 :MAILTO:requestee1@example.com
639 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee2
640 :MAILTO:requestee2@example.com
641 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
642 :MAILTO:requestee3@example.com
643 SUMMARY;LANGUAGE=en-US:test request
644 DTSTART:20150105T090000
645 DTEND:20150105T093000
649 DTSTAMP:20150101T171600Z
653 LOCATION;LANGUAGE=en-US:
657 TRIGGER;RELATED=START:-PT15M
663 mhical
-reply tentative
-contenttype -nocontenttype \
664 -infile "$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
665 >"$MH_TEST_DIR/test1.txt"
666 check
"$expected" "$MH_TEST_DIR/test1.txt"
669 # check cancel request, and -contenttype
670 cat >"$expected" <<'EOF'
671 Content-Type: text/calendar; method="CANCEL"; charset="UTF-8"
675 PRODID:nmh mhical v0.1
678 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
679 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
680 :MAILTO:requestee1@example.com
681 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
682 :MAILTO:requestee3@example.com
683 SUMMARY;LANGUAGE=en-US:Cancelled:test request
684 DTSTART:20150105T090000
685 DTEND:20150105T093000
692 LOCATION;LANGUAGE=en-US:
697 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
703 ORGANIZER;CN=Requestee2:MAILTO:requestee2@example.com
704 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee1
705 :MAILTO:requestee1@example.com
706 ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=Requestee3
707 :MAILTO:requestee3@example.com
708 SUMMARY;LANGUAGE=en-US:test request
709 DTSTART:20150105T090000
710 DTEND:20150105T093000
714 DTSTAMP:20150101T171600Z
718 LOCATION;LANGUAGE=en-US:
722 TRIGGER;RELATED=START:-PT15M
728 mhical
-cancel -contenttype <"$MH_TEST_DIR/test1.ics" | egrep -v '^DTSTAMP:' \
729 >"$MH_TEST_DIR/test1.txt"
730 check
"$expected" "$MH_TEST_DIR/test1.txt"
733 # Check TZID name wrapped with quotes, this used to cause a segfault.
734 cat >"$expected" <<'EOF'
736 Summary: Quoted timezone ID
737 At: Wed, 01 Jan 2014 00:00
738 To: Wed, 01 Jan 2014 01:00
741 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
743 PRODID:Zimbra-Calendar-Provider
746 SUMMARY:Quoted timezone ID
750 DTSTART:19710101T000000
757 DTSTART:20140101T000000
758 DTEND;TZID="Etc/GMT":20140101T010000
764 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
765 check
"$expected" "$MH_TEST_DIR/test1.txt"
768 # Check start datetime without a time, and missing end datetime.
769 cat >"$expected" <<'EOF'
771 Summary: Test datetime without time
772 At: Wed, 30 Dec 2015 00:00
773 To: Wed, 30 Dec 2015 23:59
776 cat >"$MH_TEST_DIR/test1.ics" <<'EOF'
779 PRODID:icalendar-ruby
783 DTSTAMP:20151208T204350Z
785 DTSTART;VALUE=DATE:20151230
787 SUMMARY:Test datetime without time
791 TRIGGER;RELATED=START:-PT15M
797 TZ
=UTC mhical
<"$MH_TEST_DIR/test1.ics" >"$MH_TEST_DIR/test1.txt"
798 check
"$expected" "$MH_TEST_DIR/test1.txt"
799 rm -f "$MH_TEST_DIR/test1.ics"