@@ -930,6 +930,63 @@ def test_calculate_exception_and_canceled_occurrences_with_deletion_around_dst()
930930 )
931931
932932
933+ def test_calculate_exception_and_canceled_occurrences_with_null_ical_uid () -> (
934+ None
935+ ):
936+ """Test that synthesized cancellations work when master event has null iCalUId."""
937+ master_event_null_ical = {
938+ "id" : "event-id-123" ,
939+ "iCalUId" : None , # This can happen for events before the cutoff date
940+ "originalStartTimeZone" : "Eastern Standard Time" ,
941+ "originalEndTimeZone" : "Eastern Standard Time" ,
942+ "type" : "seriesMaster" ,
943+ "subject" : "Test Event" ,
944+ "start" : {
945+ "dateTime" : "2022-09-26T12:00:00.0000000" ,
946+ "timeZone" : "UTC" ,
947+ },
948+ "end" : {"dateTime" : "2022-09-26T12:30:00.0000000" , "timeZone" : "UTC" },
949+ "recurrence" : {
950+ "pattern" : {
951+ "type" : "daily" ,
952+ "interval" : 1 ,
953+ "month" : 0 ,
954+ "dayOfMonth" : 0 ,
955+ "firstDayOfWeek" : "sunday" ,
956+ "index" : "first" ,
957+ },
958+ "range" : {
959+ "type" : "endDate" ,
960+ "startDate" : "2022-09-26" ,
961+ "endDate" : "2022-09-28" ,
962+ "recurrenceTimeZone" : "Eastern Standard Time" ,
963+ "numberOfOccurrences" : 0 ,
964+ },
965+ },
966+ }
967+
968+ occurrences = [
969+ {"originalStart" : "2022-09-26T12:00:00Z" , "type" : "occurrence" },
970+ # Missing 2022-09-27
971+ {"originalStart" : "2022-09-28T12:00:00Z" , "type" : "occurrence" },
972+ ]
973+
974+ ((), (cancellation ,)) = calculate_exception_and_canceled_occurrences (
975+ master_event_null_ical ,
976+ occurrences ,
977+ datetime .datetime (2022 , 9 , 29 , 23 , 59 , 59 , tzinfo = pytz .UTC ),
978+ )
979+
980+ assert cancellation ["type" ] == "synthesizedCancellation"
981+ assert (
982+ cancellation ["iCalUId" ] is None
983+ ) # Should be None, not a concatenated string
984+ assert (
985+ cancellation ["id" ] == "event-id-123-synthesizedCancellation-2022-09-27"
986+ )
987+ assert cancellation ["isCancelled" ] is True
988+
989+
933990master_with_exception = {
934991 "id" : "AAMkADdiYzg5OGRlLTY1MjktNDc2Ni05YmVkLWMxMzFlNTQ0MzU3YQBGAAAAAACi9RQWB-SNTZBuALM6KIOsBwBtf4g8yY_zTZgZh6x0X-50AAIM02sjAABtf4g8yY_zTZgZh6x0X-50AAIQCYpPAAA=" ,
935992 "subject" : "Expansion" ,
0 commit comments