aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorfpi2024-08-28 18:33:20 +0200
committerRobert Pluim2024-09-11 10:04:23 +0200
commit8332b4dd07a43d09ff8eed7097873d9ac4d5afc8 (patch)
tree0d70823b286166bb17f082f1ab912c5a03581acc /test
parent69e1aca041c57ba425425d31471e1c8f86d3bf04 (diff)
downloademacs-8332b4dd07a43d09ff8eed7097873d9ac4d5afc8.tar.gz
emacs-8332b4dd07a43d09ff8eed7097873d9ac4d5afc8.zip
Allow comments to organizer in icalendar event replies (Bug#72831)
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--build-reply-event-body): Add optional COMMENT argument to be inserted into the reply. (gnus-icalendar-event-reply-from-buffer): Add COMMENT argument to be passed through to gnus-icalendar-event--build-reply-event-body (gnus-icalendar-reply-accept, gnus-icalendar-reply-tentative, gnus-icalendar-reply-decline): If interactively called with a prefix argument ask user for a COMMENT to add to the reply. * test/lisp/gnus/gnus-icalendar-tests.el (gnus-icalendar-accept-with-comment, gnus-icalendar-decline-without-changing-comment): New tests.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/gnus/gnus-icalendar-tests.el72
1 files changed, 72 insertions, 0 deletions
diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el
index 08c85013d17..72f1e660077 100644
--- a/test/lisp/gnus/gnus-icalendar-tests.el
+++ b/test/lisp/gnus/gnus-icalendar-tests.el
@@ -255,5 +255,77 @@ END:VCALENDAR" (list "participant@anoncompany.com"))))
255<2020-09-21 14:00-14:30 +1w>"))) 255<2020-09-21 14:00-14:30 +1w>")))
256 (setenv "TZ" tz)))) 256 (setenv "TZ" tz))))
257 257
258(ert-deftest gnus-icalendar-accept-with-comment ()
259 ""
260 (let ((event "BEGIN:VEVENT
261DTSTART;TZID=Europe/Berlin:20200915T140000
262DTEND;TZID=Europe/Berlin:20200915T143000
263RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE
264DTSTAMP:20200915T120627Z
265ORGANIZER;CN=anon@anoncompany.com:mailto:anon@anoncompany.com
266UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000@google.com
267ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE
268 ;CN=participant@anoncompany.com;X-NUM-GUESTS=0:mailto:participant@anoncompany.com
269CREATED:20200325T095723Z
270DESCRIPTION:Coffee talk
271LAST-MODIFIED:20200915T120623Z
272LOCATION:
273SEQUENCE:0
274STATUS:CONFIRMED
275SUMMARY:Casual coffee talk
276TRANSP:OPAQUE
277END:VEVENT")
278 (icalendar-identities '("participant@anoncompany.com")))
279 (unwind-protect
280 (progn
281 (let* ((reply (with-temp-buffer
282 (insert event)
283 (gnus-icalendar-event-reply-from-buffer
284 (current-buffer)
285 'accepted
286 icalendar-identities
287 "Can not stay long."))))
288 (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply))
289 (should (string-equal (match-string 1 reply) "PARTSTAT=ACCEPTED"))
290 (should (string-match "^COMMENT:\\(.*\\)$" reply))
291 (should (string-equal (match-string 1 reply) "Can not stay long.")))))))
292
293(ert-deftest gnus-icalendar-decline-without-changing-comment ()
294 ""
295 (let ((event "BEGIN:VEVENT
296DTSTART;TZID=Europe/Berlin:20200915T140000
297DTEND;TZID=Europe/Berlin:20200915T143000
298RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE
299DTSTAMP:20200915T120627Z
300ORGANIZER;CN=anon@anoncompany.com:mailto:anon@anoncompany.com
301UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000@google.com
302ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE
303 ;CN=participant@anoncompany.com;X-NUM-GUESTS=0:mailto:participant@anoncompany.com
304CREATED:20200325T095723Z
305DESCRIPTION:Coffee talk
306LAST-MODIFIED:20200915T120623Z
307COMMENT:Only available at 2pm
308LOCATION:
309SEQUENCE:0
310STATUS:CONFIRMED
311SUMMARY:Casual coffee talk
312TRANSP:OPAQUE
313END:VEVENT")
314 (icalendar-identities '("participant@anoncompany.com")))
315 (unwind-protect
316 (progn
317 (let* ((reply (with-temp-buffer
318 (insert event)
319 (gnus-icalendar-event-reply-from-buffer
320 (current-buffer)
321 'declined
322 icalendar-identities
323 nil))))
324 (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply))
325 (should (string-equal (match-string 1 reply) "PARTSTAT=DECLINED"))
326 (should (string-match "^COMMENT:\\(.*\\)$" reply))
327 (should (string-equal (match-string 1 reply) "Only available at 2pm"))
328 )))))
329
258(provide 'gnus-icalendar-tests) 330(provide 'gnus-icalendar-tests)
259;;; gnus-icalendar-tests.el ends here 331;;; gnus-icalendar-tests.el ends here