add tests for caldav_sync, new module preamble_on_quotation
This commit is contained in:
parent
4b19f8262e
commit
0b5a791e1f
4 changed files with 3397 additions and 0 deletions
3312
caldav_sync/tests/data/Calendar.ics
Normal file
3312
caldav_sync/tests/data/Calendar.ics
Normal file
File diff suppressed because it is too large
Load diff
45
caldav_sync/tests/data/Mail Attachment.ics
Normal file
45
caldav_sync/tests/data/Mail Attachment.ics
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
BEGIN:VCALENDAR
|
||||||
|
PRODID:-//Apple Inc.//macOS 15.3.2//EN
|
||||||
|
VERSION:2.0
|
||||||
|
METHOD:REQUEST
|
||||||
|
CALSCALE:GREGORIAN
|
||||||
|
BEGIN:VTIMEZONE
|
||||||
|
TZID:America/Toronto
|
||||||
|
BEGIN:DAYLIGHT
|
||||||
|
DTSTART:20070311T020000
|
||||||
|
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
|
||||||
|
TZNAME:EDT
|
||||||
|
TZOFFSETFROM:-0500
|
||||||
|
TZOFFSETTO:-0400
|
||||||
|
END:DAYLIGHT
|
||||||
|
BEGIN:STANDARD
|
||||||
|
DTSTART:20071104T020000
|
||||||
|
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
|
||||||
|
TZNAME:EST
|
||||||
|
TZOFFSETFROM:-0400
|
||||||
|
TZOFFSETTO:-0500
|
||||||
|
END:STANDARD
|
||||||
|
END:VTIMEZONE
|
||||||
|
BEGIN:VEVENT
|
||||||
|
CREATED:20250410T122458Z
|
||||||
|
DTEND;TZID=America/Toronto:20250414T140000
|
||||||
|
DTSTAMP:20250410T122459Z
|
||||||
|
DTSTART;TZID=America/Toronto:20250414T131500
|
||||||
|
LAST-MODIFIED:20250410T122458Z
|
||||||
|
SEQUENCE:0
|
||||||
|
SUMMARY:Test
|
||||||
|
TRANSP:OPAQUE
|
||||||
|
UID:02EEF1D6-F3D2-4EB2-AD7A-1C381A629DC5
|
||||||
|
X-APPLE-CREATOR-IDENTITY:com.apple.calendar
|
||||||
|
X-APPLE-CREATOR-TEAM-IDENTITY:0000000000
|
||||||
|
BEGIN:VALARM
|
||||||
|
ACTION:NONE
|
||||||
|
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
|
||||||
|
END:VALARM
|
||||||
|
ATTENDEE;PARTSTAT=NEEDS-ACTION;EMAIL=mdurepos@durpro.com;CN=Marc Durepos;CU
|
||||||
|
TYPE=INDIVIDUAL;RSVP=TRUE:mailto:mdurepos@durpro.com
|
||||||
|
ORGANIZER;CN=Marc Durepos;EMAIL=deploy@bemade.org:mailto:marc@bemade.org
|
||||||
|
CLASS:PUBLIC
|
||||||
|
END:VEVENT
|
||||||
|
END:VCALENDAR
|
||||||
|
|
||||||
14
caldav_sync/tests/data/test_external_no_organizer.ics
Normal file
14
caldav_sync/tests/data/test_external_no_organizer.ics
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
BEGIN:VCALENDAR
|
||||||
|
VERSION:2.0
|
||||||
|
PRODID:-//Odoo//CalDAV Client//EN
|
||||||
|
BEGIN:VEVENT
|
||||||
|
UID:external-organizer-test-123
|
||||||
|
DTSTART:20250207T143000Z
|
||||||
|
DTEND:20250207T153000Z
|
||||||
|
DTSTAMP:20250207T143000Z
|
||||||
|
ATTENDEE;PARTSTAT=ACCEPTED;CN=Test User:mailto:test@example.com
|
||||||
|
ATTENDEE;PARTSTAT=ACCEPTED;CN=Mister External:mailto:mister.external@otherdomain.com
|
||||||
|
SUMMARY:Meeting with External Organizer
|
||||||
|
DESCRIPTION:This is a test event with an external organizer
|
||||||
|
END:VEVENT
|
||||||
|
END:VCALENDAR
|
||||||
|
|
@ -53,3 +53,29 @@ class TestExternalOrganizer(TransactionCase, CaldavTestCommon):
|
||||||
external_attendee,
|
external_attendee,
|
||||||
"External organizer should be present in attendees list",
|
"External organizer should be present in attendees list",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_no_organizer_external_event_sync(self):
|
||||||
|
"""Test that events without organizers are assigned to the calendar's user."""
|
||||||
|
# Setup mock for CalDAV client with our test ICS file
|
||||||
|
with _patch_caldav_with_events_from_ics(
|
||||||
|
[_get_ics_path("test_external_no_organizer.ics")], self.user
|
||||||
|
):
|
||||||
|
self.user._compute_is_caldav_enabled()
|
||||||
|
# Make sure that the current user is not the admin user
|
||||||
|
self.assertNotEqual(self.user.id, self.env.ref("base.user_admin").id)
|
||||||
|
self.env["calendar.event"].poll_caldav_server()
|
||||||
|
|
||||||
|
# Find the synced event
|
||||||
|
event = self.env["calendar.event"].search(
|
||||||
|
[("caldav_uid", "=", "external-organizer-test-123")]
|
||||||
|
)
|
||||||
|
|
||||||
|
# Verify event was created
|
||||||
|
self.assertTrue(event, "Event should be created")
|
||||||
|
|
||||||
|
# Verify user_id is set to the calendar's user
|
||||||
|
self.assertEqual(
|
||||||
|
event.user_id,
|
||||||
|
self.user,
|
||||||
|
"Event without organizer should have user_id set to calendar's user",
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue