@@ -1172,6 +1172,20 @@ def test_valarm_absolute(self):
11721172 alert = next (iter (result ["alerts" ].values ()))
11731173 assert alert ["trigger" ].endswith ("Z" )
11741174
1175+ def test_valarm_related_end (self ):
1176+ ical = _make_ical (
1177+ "DTSTART:20240615T100000Z\r \n "
1178+ "SUMMARY:End Alarm Event\r \n "
1179+ "BEGIN:VALARM\r \n "
1180+ "ACTION:DISPLAY\r \n "
1181+ "TRIGGER;RELATED=END:-PT5M\r \n "
1182+ "END:VALARM\r \n "
1183+ )
1184+ result = ical_to_jscal (ical )
1185+ alert = next (iter (result ["alerts" ].values ()))
1186+ assert alert ["trigger" ] == "-PT5M"
1187+ assert alert .get ("relativeTo" ) == "end"
1188+
11751189 def test_organizer_attendee (self ):
11761190 ical = _make_ical (
11771191 "DTSTART:20240615T100000Z\r \n "
@@ -1367,6 +1381,14 @@ def test_alert_relative(self):
13671381 assert "BEGIN:VALARM" in result
13681382 assert "TRIGGER:-PT15M" in result
13691383
1384+ def test_alert_related_end (self ):
1385+ jscal = _minimal_jscal (
1386+ alerts = {"al1" : {"trigger" : "-PT5M" , "action" : "display" , "relativeTo" : "end" }}
1387+ )
1388+ result = jscal_to_ical (jscal )
1389+ assert "RELATED=END" in result
1390+ assert "-PT5M" in result
1391+
13701392 def test_participants_organizer (self ):
13711393 jscal = _minimal_jscal (
13721394 participants = {
@@ -1542,6 +1564,12 @@ def test_create_event_raises_on_failure(self, monkeypatch):
15421564 client .create_event ("cal1" , self ._MINIMAL_ICAL )
15431565 assert exc_info .value .error_type == "invalidArguments"
15441566
1567+ def test_create_event_raises_on_malformed_response (self , monkeypatch ):
1568+ resp = self ._set_response (created = {}, notCreated = {})
1569+ client = _make_client_with_mocked_session (monkeypatch , resp )
1570+ with pytest .raises (JMAPMethodError ):
1571+ client .create_event ("cal1" , self ._MINIMAL_ICAL )
1572+
15451573 def test_create_event_passes_calendar_id (self , monkeypatch ):
15461574 resp = self ._set_response (created = {"new-0" : {"id" : "sv-2" }})
15471575 client , captured = self ._capturing_client (monkeypatch , resp )
0 commit comments