1414 RcsSuggestionActionShareLocation ,
1515 RcsSuggestionActionOpenUrl ,
1616 RcsSuggestionActionOpenUrlWebview ,
17+ RcsSuggestionActionCreateCalendarEvent ,
1718)
1819
1920
@@ -391,7 +392,6 @@ def test_rcs_suggestion_action_open_url_in_webview():
391392 assert suggestion .model_dump (by_alias = True , exclude_none = True ) == suggestion_dict
392393
393394
394- # @pytest.mark.skip(reason="Not yet implemented")
395395def test_rcs_suggestion_action_open_url_in_webview_without_url ():
396396 with pytest .raises (ValidationError ) as err :
397397 suggestion = RcsSuggestionActionOpenUrlWebview (
@@ -402,7 +402,6 @@ def test_rcs_suggestion_action_open_url_in_webview_without_url():
402402 assert "Field required" in str (err .value )
403403
404404
405- # @pytest.mark.skip(reason="Not yet implemented")
406405def test_rcs_suggestion_action_open_url_in_webview_without_description ():
407406 with pytest .raises (ValidationError ) as err :
408407 suggestion = RcsSuggestionActionOpenUrlWebview (
@@ -413,7 +412,6 @@ def test_rcs_suggestion_action_open_url_in_webview_without_description():
413412 assert "Field required" in str (err .value )
414413
415414
416- # @pytest.mark.skip(reason="Not yet implemented")
417415def test_rcs_suggestion_action_open_url_in_webview_with_description_too_short ():
418416 with pytest .raises (ValidationError ) as err :
419417 suggestion = RcsSuggestionActionOpenUrlWebview (
@@ -425,7 +423,6 @@ def test_rcs_suggestion_action_open_url_in_webview_with_description_too_short():
425423 assert "String should have at least 1 character" in str (err .value )
426424
427425
428- # @pytest.mark.skip(reason="Not yet implemented")
429426def test_rcs_suggestion_action_open_url_in_webview_with_description_too_long ():
430427 with pytest .raises (ValidationError ) as err :
431428 suggestion = RcsSuggestionActionOpenUrlWebview (
@@ -447,3 +444,126 @@ def test_rcs_suggestion_action_open_url_in_webview_with_invalid_view_mode():
447444 view_mode = 'INVALID_VIEW_MODE' ,
448445 )
449446 assert "Input should be 'FULL', 'TALL' or 'HALF'" in str (err .value )
447+
448+
449+ def test_rcs_suggestion_action_create_calendar_event ():
450+ suggestion = RcsSuggestionActionCreateCalendarEvent (
451+ text = 'Add to calendar' ,
452+ postback_data = 'postback-data' ,
453+ start_time = '2024-01-01T12:00:00Z' ,
454+ end_time = '2024-01-01T13:00:00Z' ,
455+ title = 'Meeting with Bob' ,
456+ description = 'Discuss project updates' ,
457+ fallback_url = 'https://example.com/calendar-event' ,
458+ )
459+ suggestion_dict = {
460+ 'type' : 'create_calendar_event' ,
461+ 'text' : 'Add to calendar' ,
462+ 'postback_data' : 'postback-data' ,
463+ 'start_time' : '2024-01-01T12:00:00Z' ,
464+ 'end_time' : '2024-01-01T13:00:00Z' ,
465+ 'title' : 'Meeting with Bob' ,
466+ 'description' : 'Discuss project updates' ,
467+ 'fallback_url' : 'https://example.com/calendar-event' ,
468+ }
469+ assert suggestion .model_dump (by_alias = True , exclude_none = True ) == suggestion_dict
470+
471+
472+ def test_rcs_suggestion_action_create_calendar_event_without_start_time ():
473+ with pytest .raises (ValidationError ) as err :
474+ suggestion = RcsSuggestionActionCreateCalendarEvent (
475+ text = 'Add to calendar' ,
476+ postback_data = 'postback-data' ,
477+ end_time = '2024-01-01T13:00:00Z' ,
478+ title = 'Meeting with Bob' ,
479+ description = 'Discuss project updates' ,
480+ )
481+ assert "Field required" in str (err .value )
482+
483+
484+ def test_rcs_suggestion_action_create_calendar_event_without_end_time ():
485+ with pytest .raises (ValidationError ) as err :
486+ suggestion = RcsSuggestionActionCreateCalendarEvent (
487+ text = 'Add to calendar' ,
488+ postback_data = 'postback-data' ,
489+ start_time = '2024-01-01T12:00:00Z' ,
490+ title = 'Meeting with Bob' ,
491+ description = 'Discuss project updates' ,
492+ )
493+ assert "Field required" in str (err .value )
494+
495+
496+ def test_rcs_suggestion_action_create_calendar_event_without_title ():
497+ with pytest .raises (ValidationError ) as err :
498+ suggestion = RcsSuggestionActionCreateCalendarEvent (
499+ text = 'Add to calendar' ,
500+ postback_data = 'postback-data' ,
501+ start_time = '2024-01-01T12:00:00Z' ,
502+ end_time = '2024-01-01T13:00:00Z' ,
503+ description = 'Discuss project updates' ,
504+ )
505+ assert "Field required" in str (err .value )
506+
507+
508+ def test_rcs_suggestion_action_create_calendar_event_without_description ():
509+ with pytest .raises (ValidationError ) as err :
510+ suggestion = RcsSuggestionActionCreateCalendarEvent (
511+ text = 'Add to calendar' ,
512+ postback_data = 'postback-data' ,
513+ start_time = '2024-01-01T12:00:00Z' ,
514+ end_time = '2024-01-01T13:00:00Z' ,
515+ title = 'Meeting with Bob' ,
516+ )
517+ assert "Field required" in str (err .value )
518+
519+
520+ def test_rcs_suggestion_action_create_calendar_event_with_title_too_short ():
521+ with pytest .raises (ValidationError ) as err :
522+ suggestion = RcsSuggestionActionCreateCalendarEvent (
523+ text = 'Add to calendar' ,
524+ postback_data = 'postback-data' ,
525+ start_time = '2024-01-01T12:00:00Z' ,
526+ end_time = '2024-01-01T13:00:00Z' ,
527+ title = '' ,
528+ description = 'Discuss project updates' ,
529+ )
530+ assert "String should have at least 1 character" in str (err .value )
531+
532+
533+ def test_rcs_suggestion_action_create_calendar_event_with_title_too_long ():
534+ with pytest .raises (ValidationError ) as err :
535+ suggestion = RcsSuggestionActionCreateCalendarEvent (
536+ text = 'Add to calendar' ,
537+ postback_data = 'postback-data' ,
538+ start_time = '2024-01-01T12:00:00Z' ,
539+ end_time = '2024-01-01T13:00:00Z' ,
540+ title = 'A' * 100 + 'B' ,
541+ description = 'Discuss project updates' ,
542+ )
543+ assert "String should have at most 100 characters" in str (err .value )
544+
545+
546+ def test_rcs_suggestion_action_create_calendar_event_with_description_too_short ():
547+ with pytest .raises (ValidationError ) as err :
548+ suggestion = RcsSuggestionActionCreateCalendarEvent (
549+ text = 'Add to calendar' ,
550+ postback_data = 'postback-data' ,
551+ start_time = '2024-01-01T12:00:00Z' ,
552+ end_time = '2024-01-01T13:00:00Z' ,
553+ title = 'Meeting with Bob' ,
554+ description = '' ,
555+ )
556+ assert "String should have at least 1 character" in str (err .value )
557+
558+
559+ def test_rcs_suggestion_action_create_calendar_event_with_description_too_long ():
560+ with pytest .raises (ValidationError ) as err :
561+ suggestion = RcsSuggestionActionCreateCalendarEvent (
562+ text = 'Add to calendar' ,
563+ postback_data = 'postback-data' ,
564+ start_time = '2024-01-01T12:00:00Z' ,
565+ end_time = '2024-01-01T13:00:00Z' ,
566+ title = 'Meeting with Bob' ,
567+ description = 'A' * 500 + 'B' ,
568+ )
569+ assert "String should have at most 500 characters" in str (err .value )
0 commit comments