@@ -191,6 +191,72 @@ def test_meeting_url_in_location(
191191 assert ics
192192 assert ':' .join (['LOCATION' , slot .meeting_link_url ]) in ics .decode ()
193193
194+ def test_prodid_is_set (self , make_google_calendar , make_appointment , make_pro_subscriber ):
195+ """Verify that the prodid is set correctly in the calendar"""
196+ subscriber = make_pro_subscriber ()
197+ calendar = make_google_calendar (subscriber_id = subscriber .id )
198+ appointment = make_appointment (calendar_id = calendar .id )
199+ slot = appointment .slots [0 ]
200+
201+ ics = Tools ().create_vevent (appointment , slot , subscriber )
202+ ics_str = ics .decode ()
203+
204+ assert 'PRODID:-//thunderbird.net/Thunderbird Appointment//EN' in ics_str
205+
206+ def test_attendee_with_name (self , make_google_calendar , make_appointment , make_pro_subscriber ):
207+ """Verify attendee is added with name when slot has an attendee with a name"""
208+ subscriber = make_pro_subscriber ()
209+ calendar = make_google_calendar (subscriber_id = subscriber .id )
210+ appointment = make_appointment (calendar_id = calendar .id )
211+ slot = appointment .slots [0 ]
212+ slot .
attendee = models .
Attendee (
email = '[email protected] ' ,
name = 'John Doe' ,
timezone = 'Europe/Berlin' )
213+
214+ ics = Tools ().create_vevent (appointment , slot , subscriber )
215+ ics_str = ics .decode ()
216+
217+ # Unfold lines (remove CRLF + leading space) and drop CR to keep assertions simple
218+ ics_str = ics_str .replace ('\r \n ' , '' ).replace ('\r ' , '' )
219+
220+ assert 'ATTENDEE' in ics_str
221+ assert 'MAILTO:[email protected] ' in ics_str 222+ assert 'CN="John Doe"' in ics_str
223+ assert 'ROLE=REQ-PARTICIPANT' in ics_str
224+ assert 'PARTSTAT=ACCEPTED' in ics_str
225+
226+ def test_attendee_without_name_uses_email (self , make_google_calendar , make_appointment , make_pro_subscriber ):
227+ """Verify attendee is added with email as name when slot has an attendee without a name"""
228+ subscriber = make_pro_subscriber ()
229+ calendar = make_google_calendar (subscriber_id = subscriber .id )
230+ appointment = make_appointment (calendar_id = calendar .id )
231+ slot = appointment .slots [0 ]
232+ slot .
attendee = models .
Attendee (
email = '[email protected] ' ,
name = None ,
timezone = 'Europe/Berlin' )
233+
234+ ics = Tools ().create_vevent (appointment , slot , subscriber )
235+ ics_str = ics .decode ()
236+
237+ # Unfold lines (remove CRLF + leading space) and drop CR to keep assertions simple
238+ ics_str = ics_str .replace ('\r \n ' , '' ).replace ('\r ' , '' )
239+
240+ assert 'ATTENDEE' in ics_str
241+ assert 'MAILTO:[email protected] ' in ics_str 242+ assert '[email protected] ' in ics_str 243+ assert 'ROLE=REQ-PARTICIPANT' in ics_str
244+ assert 'PARTSTAT=ACCEPTED' in ics_str
245+
246+ def test_no_attendee (self , make_google_calendar , make_appointment , make_pro_subscriber ):
247+ """Verify no attendee is added when slot has no attendee"""
248+ subscriber = make_pro_subscriber ()
249+ calendar = make_google_calendar (subscriber_id = subscriber .id )
250+ appointment = make_appointment (calendar_id = calendar .id )
251+ slot = appointment .slots [0 ]
252+ slot .attendee = None
253+
254+ ics = Tools ().create_vevent (appointment , slot , subscriber )
255+ ics_str = ics .decode ()
256+
257+ # The ATTENDEE field should not be present when there's no attendee
258+ assert 'ATTENDEE' not in ics_str
259+
194260
195261class TestDnsCaldavLookup :
196262 def test_for_host (self ):
0 commit comments