tilia-dav 3.1.0.pre.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.database.travis.yml +6 -0
- data/.gitignore +25 -0
- data/.rubocop.yml +35 -0
- data/.simplecov +4 -0
- data/.travis.yml +10 -0
- data/CHANGELOG.sabre.md +2084 -0
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +103 -0
- data/LICENSE +27 -0
- data/LICENSE.sabre +27 -0
- data/README.md +40 -0
- data/Rakefile +18 -0
- data/database.sample.yml +6 -0
- data/examples/minimal.rb +25 -0
- data/lib/tilia/cal_dav.rb +27 -0
- data/lib/tilia/cal_dav/backend.rb +17 -0
- data/lib/tilia/cal_dav/backend/abstract_backend.rb +194 -0
- data/lib/tilia/cal_dav/backend/backend_interface.rb +250 -0
- data/lib/tilia/cal_dav/backend/notification_support.rb +38 -0
- data/lib/tilia/cal_dav/backend/scheduling_support.rb +57 -0
- data/lib/tilia/cal_dav/backend/sequel.rb +1118 -0
- data/lib/tilia/cal_dav/backend/sharing_support.rb +239 -0
- data/lib/tilia/cal_dav/backend/subscription_support.rb +79 -0
- data/lib/tilia/cal_dav/backend/sync_support.rb +75 -0
- data/lib/tilia/cal_dav/calendar.rb +426 -0
- data/lib/tilia/cal_dav/calendar_home.rb +335 -0
- data/lib/tilia/cal_dav/calendar_object.rb +219 -0
- data/lib/tilia/cal_dav/calendar_query_validator.rb +294 -0
- data/lib/tilia/cal_dav/calendar_root.rb +57 -0
- data/lib/tilia/cal_dav/exception.rb +7 -0
- data/lib/tilia/cal_dav/exception/invalid_component_type.rb +21 -0
- data/lib/tilia/cal_dav/i_calendar.rb +11 -0
- data/lib/tilia/cal_dav/i_calendar_object.rb +13 -0
- data/lib/tilia/cal_dav/i_calendar_object_container.rb +32 -0
- data/lib/tilia/cal_dav/i_shareable_calendar.rb +40 -0
- data/lib/tilia/cal_dav/i_shared_calendar.rb +28 -0
- data/lib/tilia/cal_dav/ics_export_plugin.rb +327 -0
- data/lib/tilia/cal_dav/notifications.rb +12 -0
- data/lib/tilia/cal_dav/notifications/collection.rb +131 -0
- data/lib/tilia/cal_dav/notifications/i_collection.rb +17 -0
- data/lib/tilia/cal_dav/notifications/i_node.rb +30 -0
- data/lib/tilia/cal_dav/notifications/node.rb +142 -0
- data/lib/tilia/cal_dav/notifications/plugin.rb +138 -0
- data/lib/tilia/cal_dav/plugin.rb +891 -0
- data/lib/tilia/cal_dav/principal.rb +12 -0
- data/lib/tilia/cal_dav/principal/collection.rb +21 -0
- data/lib/tilia/cal_dav/principal/i_proxy_read.rb +13 -0
- data/lib/tilia/cal_dav/principal/i_proxy_write.rb +13 -0
- data/lib/tilia/cal_dav/principal/proxy_read.rb +127 -0
- data/lib/tilia/cal_dav/principal/proxy_write.rb +127 -0
- data/lib/tilia/cal_dav/principal/user.rb +96 -0
- data/lib/tilia/cal_dav/schedule.rb +14 -0
- data/lib/tilia/cal_dav/schedule/i_inbox.rb +12 -0
- data/lib/tilia/cal_dav/schedule/i_mip_plugin.rb +156 -0
- data/lib/tilia/cal_dav/schedule/i_outbox.rb +12 -0
- data/lib/tilia/cal_dav/schedule/i_scheduling_object.rb +10 -0
- data/lib/tilia/cal_dav/schedule/inbox.rb +211 -0
- data/lib/tilia/cal_dav/schedule/outbox.rb +143 -0
- data/lib/tilia/cal_dav/schedule/plugin.rb +851 -0
- data/lib/tilia/cal_dav/schedule/scheduling_object.rb +126 -0
- data/lib/tilia/cal_dav/shareable_calendar.rb +54 -0
- data/lib/tilia/cal_dav/shared_calendar.rb +120 -0
- data/lib/tilia/cal_dav/sharing_plugin.rb +359 -0
- data/lib/tilia/cal_dav/subscriptions.rb +9 -0
- data/lib/tilia/cal_dav/subscriptions/i_subscription.rb +37 -0
- data/lib/tilia/cal_dav/subscriptions/plugin.rb +83 -0
- data/lib/tilia/cal_dav/subscriptions/subscription.rb +205 -0
- data/lib/tilia/cal_dav/xml.rb +10 -0
- data/lib/tilia/cal_dav/xml/filter.rb +12 -0
- data/lib/tilia/cal_dav/xml/filter/calendar_data.rb +64 -0
- data/lib/tilia/cal_dav/xml/filter/comp_filter.rb +79 -0
- data/lib/tilia/cal_dav/xml/filter/param_filter.rb +66 -0
- data/lib/tilia/cal_dav/xml/filter/prop_filter.rb +80 -0
- data/lib/tilia/cal_dav/xml/notification.rb +13 -0
- data/lib/tilia/cal_dav/xml/notification/invite.rb +253 -0
- data/lib/tilia/cal_dav/xml/notification/invite_reply.rb +167 -0
- data/lib/tilia/cal_dav/xml/notification/notification_interface.rb +41 -0
- data/lib/tilia/cal_dav/xml/notification/system_status.rb +139 -0
- data/lib/tilia/cal_dav/xml/property.rb +15 -0
- data/lib/tilia/cal_dav/xml/property/allowed_sharing_modes.rb +64 -0
- data/lib/tilia/cal_dav/xml/property/email_address_set.rb +60 -0
- data/lib/tilia/cal_dav/xml/property/invite.rb +207 -0
- data/lib/tilia/cal_dav/xml/property/schedule_calendar_transp.rb +108 -0
- data/lib/tilia/cal_dav/xml/property/supported_calendar_component_set.rb +100 -0
- data/lib/tilia/cal_dav/xml/property/supported_calendar_data.rb +50 -0
- data/lib/tilia/cal_dav/xml/property/supported_collation_set.rb +47 -0
- data/lib/tilia/cal_dav/xml/request.rb +14 -0
- data/lib/tilia/cal_dav/xml/request/calendar_multi_get_report.rb +99 -0
- data/lib/tilia/cal_dav/xml/request/calendar_query_report.rb +112 -0
- data/lib/tilia/cal_dav/xml/request/free_busy_query_report.rb +70 -0
- data/lib/tilia/cal_dav/xml/request/invite_reply.rb +110 -0
- data/lib/tilia/cal_dav/xml/request/mk_calendar.rb +67 -0
- data/lib/tilia/cal_dav/xml/request/share.rb +93 -0
- data/lib/tilia/card_dav.rb +17 -0
- data/lib/tilia/card_dav/address_book.rb +338 -0
- data/lib/tilia/card_dav/address_book_home.rb +192 -0
- data/lib/tilia/card_dav/address_book_root.rb +58 -0
- data/lib/tilia/card_dav/backend.rb +12 -0
- data/lib/tilia/card_dav/backend/abstract_backend.rb +30 -0
- data/lib/tilia/card_dav/backend/backend_interface.rb +175 -0
- data/lib/tilia/card_dav/backend/sequel.rb +476 -0
- data/lib/tilia/card_dav/backend/sync_support.rb +80 -0
- data/lib/tilia/card_dav/card.rb +193 -0
- data/lib/tilia/card_dav/i_address_book.rb +10 -0
- data/lib/tilia/card_dav/i_card.rb +11 -0
- data/lib/tilia/card_dav/i_directory.rb +14 -0
- data/lib/tilia/card_dav/plugin.rb +724 -0
- data/lib/tilia/card_dav/vcf_export_plugin.rb +122 -0
- data/lib/tilia/card_dav/xml.rb +9 -0
- data/lib/tilia/card_dav/xml/filter.rb +11 -0
- data/lib/tilia/card_dav/xml/filter/address_data.rb +50 -0
- data/lib/tilia/card_dav/xml/filter/param_filter.rb +71 -0
- data/lib/tilia/card_dav/xml/filter/prop_filter.rb +77 -0
- data/lib/tilia/card_dav/xml/property.rb +10 -0
- data/lib/tilia/card_dav/xml/property/supported_address_data.rb +67 -0
- data/lib/tilia/card_dav/xml/property/supported_collation_set.rb +38 -0
- data/lib/tilia/card_dav/xml/request.rb +10 -0
- data/lib/tilia/card_dav/xml/request/address_book_multi_get_report.rb +91 -0
- data/lib/tilia/card_dav/xml/request/address_book_query_report.rb +156 -0
- data/lib/tilia/dav.rb +94 -0
- data/lib/tilia/dav/auth.rb +8 -0
- data/lib/tilia/dav/auth/backend.rb +15 -0
- data/lib/tilia/dav/auth/backend/abstract_basic.rb +119 -0
- data/lib/tilia/dav/auth/backend/abstract_digest.rb +132 -0
- data/lib/tilia/dav/auth/backend/apache.rb +85 -0
- data/lib/tilia/dav/auth/backend/backend_interface.rb +61 -0
- data/lib/tilia/dav/auth/backend/basic_call_back.rb +46 -0
- data/lib/tilia/dav/auth/backend/file.rb +61 -0
- data/lib/tilia/dav/auth/backend/sequel.rb +46 -0
- data/lib/tilia/dav/auth/plugin.rb +157 -0
- data/lib/tilia/dav/browser.rb +12 -0
- data/lib/tilia/dav/browser/assets/favicon.ico +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/ICON-LICENSE +21 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.css +510 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.eot +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.otf +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.svg +543 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.ttf +0 -0
- data/lib/tilia/dav/browser/assets/openiconic/open-iconic.woff +0 -0
- data/lib/tilia/dav/browser/assets/sabredav.css +228 -0
- data/lib/tilia/dav/browser/assets/sabredav.png +0 -0
- data/lib/tilia/dav/browser/guess_content_type.rb +80 -0
- data/lib/tilia/dav/browser/html_output.rb +27 -0
- data/lib/tilia/dav/browser/html_output_helper.rb +86 -0
- data/lib/tilia/dav/browser/map_get_to_prop_find.rb +41 -0
- data/lib/tilia/dav/browser/plugin.rb +693 -0
- data/lib/tilia/dav/browser/prop_find_all.rb +95 -0
- data/lib/tilia/dav/client.rb +341 -0
- data/lib/tilia/dav/collection.rb +79 -0
- data/lib/tilia/dav/core_plugin.rb +824 -0
- data/lib/tilia/dav/exception.rb +59 -0
- data/lib/tilia/dav/exception/bad_request.rb +18 -0
- data/lib/tilia/dav/exception/conflict.rb +18 -0
- data/lib/tilia/dav/exception/conflicting_lock.rb +26 -0
- data/lib/tilia/dav/exception/forbidden.rb +18 -0
- data/lib/tilia/dav/exception/insufficient_storage.rb +18 -0
- data/lib/tilia/dav/exception/invalid_resource_type.rb +23 -0
- data/lib/tilia/dav/exception/invalid_sync_token.rb +26 -0
- data/lib/tilia/dav/exception/length_required.rb +18 -0
- data/lib/tilia/dav/exception/lock_token_matches_request_uri.rb +25 -0
- data/lib/tilia/dav/exception/locked.rb +48 -0
- data/lib/tilia/dav/exception/method_not_allowed.rb +29 -0
- data/lib/tilia/dav/exception/not_authenticated.rb +18 -0
- data/lib/tilia/dav/exception/not_found.rb +18 -0
- data/lib/tilia/dav/exception/not_implemented.rb +18 -0
- data/lib/tilia/dav/exception/payment_required.rb +18 -0
- data/lib/tilia/dav/exception/precondition_failed.rb +47 -0
- data/lib/tilia/dav/exception/report_not_supported.rb +21 -0
- data/lib/tilia/dav/exception/requested_range_not_satisfiable.rb +18 -0
- data/lib/tilia/dav/exception/service_unavailable.rb +18 -0
- data/lib/tilia/dav/exception/too_many_matches.rb +21 -0
- data/lib/tilia/dav/exception/unsupported_media_type.rb +18 -0
- data/lib/tilia/dav/file.rb +58 -0
- data/lib/tilia/dav/fs.rb +9 -0
- data/lib/tilia/dav/fs/directory.rb +119 -0
- data/lib/tilia/dav/fs/file.rb +69 -0
- data/lib/tilia/dav/fs/node.rb +57 -0
- data/lib/tilia/dav/fs_ext.rb +8 -0
- data/lib/tilia/dav/fs_ext/directory.rb +175 -0
- data/lib/tilia/dav/fs_ext/file.rb +118 -0
- data/lib/tilia/dav/i_collection.rb +65 -0
- data/lib/tilia/dav/i_extended_collection.rb +36 -0
- data/lib/tilia/dav/i_file.rb +70 -0
- data/lib/tilia/dav/i_move_target.rb +37 -0
- data/lib/tilia/dav/i_multi_get.rb +29 -0
- data/lib/tilia/dav/i_node.rb +33 -0
- data/lib/tilia/dav/i_properties.rb +39 -0
- data/lib/tilia/dav/i_quota.rb +19 -0
- data/lib/tilia/dav/locks.rb +9 -0
- data/lib/tilia/dav/locks/backend.rb +12 -0
- data/lib/tilia/dav/locks/backend/abstract_backend.rb +16 -0
- data/lib/tilia/dav/locks/backend/backend_interface.rb +41 -0
- data/lib/tilia/dav/locks/backend/file.rb +146 -0
- data/lib/tilia/dav/locks/backend/sequel.rb +154 -0
- data/lib/tilia/dav/locks/lock_info.rb +60 -0
- data/lib/tilia/dav/locks/plugin.rb +467 -0
- data/lib/tilia/dav/mk_col.rb +47 -0
- data/lib/tilia/dav/mount.rb +7 -0
- data/lib/tilia/dav/mount/plugin.rb +62 -0
- data/lib/tilia/dav/node.rb +36 -0
- data/lib/tilia/dav/partial_update.rb +8 -0
- data/lib/tilia/dav/partial_update/i_patch_support.rb +40 -0
- data/lib/tilia/dav/partial_update/plugin.rb +179 -0
- data/lib/tilia/dav/prop_find.rb +262 -0
- data/lib/tilia/dav/prop_patch.rb +278 -0
- data/lib/tilia/dav/property_storage.rb +8 -0
- data/lib/tilia/dav/property_storage/backend.rb +10 -0
- data/lib/tilia/dav/property_storage/backend/backend_interface.rb +69 -0
- data/lib/tilia/dav/property_storage/backend/sequel.rb +192 -0
- data/lib/tilia/dav/property_storage/plugin.rb +131 -0
- data/lib/tilia/dav/server.rb +1388 -0
- data/lib/tilia/dav/server_plugin.rb +81 -0
- data/lib/tilia/dav/simple_collection.rb +71 -0
- data/lib/tilia/dav/simple_file.rb +82 -0
- data/lib/tilia/dav/string_util.rb +68 -0
- data/lib/tilia/dav/sync.rb +8 -0
- data/lib/tilia/dav/sync/i_sync_collection.rb +80 -0
- data/lib/tilia/dav/sync/plugin.rb +225 -0
- data/lib/tilia/dav/temporary_file_filter_plugin.rb +248 -0
- data/lib/tilia/dav/tree.rb +270 -0
- data/lib/tilia/dav/uuid_util.rb +45 -0
- data/lib/tilia/dav/version.rb +9 -0
- data/lib/tilia/dav/xml.rb +11 -0
- data/lib/tilia/dav/xml/element.rb +10 -0
- data/lib/tilia/dav/xml/element/prop.rb +92 -0
- data/lib/tilia/dav/xml/element/response.rb +188 -0
- data/lib/tilia/dav/xml/property.rb +16 -0
- data/lib/tilia/dav/xml/property/complex.rb +76 -0
- data/lib/tilia/dav/xml/property/get_last_modified.rb +79 -0
- data/lib/tilia/dav/xml/property/href.rb +137 -0
- data/lib/tilia/dav/xml/property/lock_discovery.rb +89 -0
- data/lib/tilia/dav/xml/property/resource_type.rb +96 -0
- data/lib/tilia/dav/xml/property/supported_lock.rb +48 -0
- data/lib/tilia/dav/xml/property/supported_method_set.rb +101 -0
- data/lib/tilia/dav/xml/property/supported_report_set.rb +118 -0
- data/lib/tilia/dav/xml/request.rb +13 -0
- data/lib/tilia/dav/xml/request/lock.rb +67 -0
- data/lib/tilia/dav/xml/request/mk_col.rb +69 -0
- data/lib/tilia/dav/xml/request/prop_find.rb +70 -0
- data/lib/tilia/dav/xml/request/prop_patch.rb +101 -0
- data/lib/tilia/dav/xml/request/sync_collection_report.rb +102 -0
- data/lib/tilia/dav/xml/response.rb +9 -0
- data/lib/tilia/dav/xml/response/multi_status.rb +108 -0
- data/lib/tilia/dav/xml/service.rb +42 -0
- data/lib/tilia/dav_acl.rb +16 -0
- data/lib/tilia/dav_acl/abstract_principal_collection.rb +143 -0
- data/lib/tilia/dav_acl/exception.rb +11 -0
- data/lib/tilia/dav_acl/exception/ace_conflict.rb +21 -0
- data/lib/tilia/dav_acl/exception/need_privileges.rb +65 -0
- data/lib/tilia/dav_acl/exception/no_abstract.rb +21 -0
- data/lib/tilia/dav_acl/exception/not_recognized_principal.rb +21 -0
- data/lib/tilia/dav_acl/exception/not_supported_privilege.rb +21 -0
- data/lib/tilia/dav_acl/fs.rb +9 -0
- data/lib/tilia/dav_acl/fs/collection.rb +108 -0
- data/lib/tilia/dav_acl/fs/file.rb +87 -0
- data/lib/tilia/dav_acl/fs/home_collection.rb +148 -0
- data/lib/tilia/dav_acl/i_acl.rb +61 -0
- data/lib/tilia/dav_acl/i_principal.rb +63 -0
- data/lib/tilia/dav_acl/i_principal_collection.rb +52 -0
- data/lib/tilia/dav_acl/plugin.rb +1109 -0
- data/lib/tilia/dav_acl/principal.rb +213 -0
- data/lib/tilia/dav_acl/principal_backend.rb +11 -0
- data/lib/tilia/dav_acl/principal_backend/abstract_backend.rb +42 -0
- data/lib/tilia/dav_acl/principal_backend/backend_interface.rb +127 -0
- data/lib/tilia/dav_acl/principal_backend/create_principal_support.rb +27 -0
- data/lib/tilia/dav_acl/principal_backend/sequel.rb +313 -0
- data/lib/tilia/dav_acl/principal_collection.rb +117 -0
- data/lib/tilia/dav_acl/xml.rb +8 -0
- data/lib/tilia/dav_acl/xml/property.rb +13 -0
- data/lib/tilia/dav_acl/xml/property/acl.rb +222 -0
- data/lib/tilia/dav_acl/xml/property/acl_restrictions.rb +40 -0
- data/lib/tilia/dav_acl/xml/property/current_user_privilege_set.rb +125 -0
- data/lib/tilia/dav_acl/xml/property/principal.rb +149 -0
- data/lib/tilia/dav_acl/xml/property/supported_privilege_set.rb +135 -0
- data/lib/tilia/dav_acl/xml/request.rb +11 -0
- data/lib/tilia/dav_acl/xml/request/expand_property_report.rb +86 -0
- data/lib/tilia/dav_acl/xml/request/principal_property_search_report.rb +111 -0
- data/lib/tilia/dav_acl/xml/request/principal_search_property_set_report.rb +49 -0
- data/test/cal_dav/backend/abstract_sequel_test.rb +817 -0
- data/test/cal_dav/backend/abstract_test.rb +163 -0
- data/test/cal_dav/backend/mock.rb +169 -0
- data/test/cal_dav/backend/mock_scheduling.rb +84 -0
- data/test/cal_dav/backend/mock_sharing.rb +124 -0
- data/test/cal_dav/backend/mock_subscription_support.rb +123 -0
- data/test/cal_dav/backend/sequel_my_sql_test.rb +102 -0
- data/test/cal_dav/backend/sequel_sqlite_test.rb +105 -0
- data/test/cal_dav/calendar_home_notifications_test.rb +41 -0
- data/test/cal_dav/calendar_home_shared_calendars_test.rb +64 -0
- data/test/cal_dav/calendar_home_subscriptions_test.rb +67 -0
- data/test/cal_dav/calendar_home_test.rb +144 -0
- data/test/cal_dav/calendar_object_test.rb +317 -0
- data/test/cal_dav/calendar_query_v_alarm_test.rb +114 -0
- data/test/cal_dav/calendar_query_validator_test.rb +820 -0
- data/test/cal_dav/calendar_test.rb +203 -0
- data/test/cal_dav/expand_events_double_events_test.rb +94 -0
- data/test/cal_dav/expand_events_dtstar_tand_dten_dby_day_test.rb +94 -0
- data/test/cal_dav/expand_events_dtstar_tand_dtend_test.rb +100 -0
- data/test/cal_dav/expand_events_floating_time_test.rb +211 -0
- data/test/cal_dav/free_busy_report_test.rb +156 -0
- data/test/cal_dav/get_events_by_timerange_test.rb +74 -0
- data/test/cal_dav/ics_export_plugin_test.rb +638 -0
- data/test/cal_dav/issue166_test.rb +59 -0
- data/test/cal_dav/issue172_test.rb +139 -0
- data/test/cal_dav/issue203_test.rb +130 -0
- data/test/cal_dav/issue205_test.rb +89 -0
- data/test/cal_dav/issue211_test.rb +84 -0
- data/test/cal_dav/issue220_test.rb +94 -0
- data/test/cal_dav/issue228_test.rb +74 -0
- data/test/cal_dav/j_cal_transform_test.rb +244 -0
- data/test/cal_dav/notifications/collection_test.rb +67 -0
- data/test/cal_dav/notifications/node_test.rb +73 -0
- data/test/cal_dav/notifications/plugin_test.rb +144 -0
- data/test/cal_dav/plugin_test.rb +1049 -0
- data/test/cal_dav/principal/collection_test.rb +19 -0
- data/test/cal_dav/principal/proxy_read_test.rb +67 -0
- data/test/cal_dav/principal/proxy_write_test.rb +29 -0
- data/test/cal_dav/principal/user_test.rb +91 -0
- data/test/cal_dav/schedule/deliver_new_event_test.rb +81 -0
- data/test/cal_dav/schedule/free_busy_request_test.rb +565 -0
- data/test/cal_dav/schedule/i_mip/mock_plugin.rb +40 -0
- data/test/cal_dav/schedule/i_mip_plugin_test.rb +196 -0
- data/test/cal_dav/schedule/inbox_test.rb +150 -0
- data/test/cal_dav/schedule/outbox_post_test.rb +124 -0
- data/test/cal_dav/schedule/outbox_test.rb +76 -0
- data/test/cal_dav/schedule/plugin_basic_test.rb +39 -0
- data/test/cal_dav/schedule/plugin_properties_test.rb +96 -0
- data/test/cal_dav/schedule/plugin_properties_with_shared_calendar_test.rb +69 -0
- data/test/cal_dav/schedule/schedule_deliver_test.rb +605 -0
- data/test/cal_dav/schedule/scheduling_object_test.rb +327 -0
- data/test/cal_dav/shareable_calendar_test.rb +58 -0
- data/test/cal_dav/shared_calendar_test.rb +189 -0
- data/test/cal_dav/sharing_plugin_test.rb +373 -0
- data/test/cal_dav/subscriptions/create_subscription_test.rb +115 -0
- data/test/cal_dav/subscriptions/plugin_test.rb +46 -0
- data/test/cal_dav/subscriptions/subscription_test.rb +119 -0
- data/test/cal_dav/test_util.rb +164 -0
- data/test/cal_dav/validate_i_cal_test.rb +219 -0
- data/test/cal_dav/xml/notification/invite_reply_test.rb +136 -0
- data/test/cal_dav/xml/notification/invite_test.rb +225 -0
- data/test/cal_dav/xml/notification/system_status_test.rb +63 -0
- data/test/cal_dav/xml/property/allowed_sharing_modes_test.rb +34 -0
- data/test/cal_dav/xml/property/email_address_set_test.rb +35 -0
- data/test/cal_dav/xml/property/invite_test.rb +173 -0
- data/test/cal_dav/xml/property/schedule_calendar_transp_test.rb +96 -0
- data/test/cal_dav/xml/property/supported_calendar_component_set_test.rb +76 -0
- data/test/cal_dav/xml/property/supported_calendar_data_test.rb +32 -0
- data/test/cal_dav/xml/property/supported_collation_set_test.rb +33 -0
- data/test/cal_dav/xml/request/calendar_query_report_test.rb +339 -0
- data/test/cal_dav/xml/request/invite_reply_test.rb +68 -0
- data/test/cal_dav/xml/request/share_test.rb +79 -0
- data/test/card_dav/abstract_plugin_test.rb +24 -0
- data/test/card_dav/address_book_home_test.rb +128 -0
- data/test/card_dav/address_book_query_test.rb +303 -0
- data/test/card_dav/address_book_root_test.rb +26 -0
- data/test/card_dav/address_book_test.rb +166 -0
- data/test/card_dav/backend/abstract_sequel_test.rb +302 -0
- data/test/card_dav/backend/mock.rb +122 -0
- data/test/card_dav/backend/sequel_my_sql_test.rb +56 -0
- data/test/card_dav/backend/sequel_sqlite_test.rb +59 -0
- data/test/card_dav/card_test.rb +164 -0
- data/test/card_dav/i_directory_test.rb +22 -0
- data/test/card_dav/multi_get_test.rb +97 -0
- data/test/card_dav/plugin_test.rb +87 -0
- data/test/card_dav/sogo_strip_content_type_test.rb +63 -0
- data/test/card_dav/test_util.rb +51 -0
- data/test/card_dav/validate_filter_test.rb +210 -0
- data/test/card_dav/validate_v_card_test.rb +143 -0
- data/test/card_dav/vcf_export_test.rb +66 -0
- data/test/card_dav/xml/property/supported_address_data_test.rb +34 -0
- data/test/card_dav/xml/property/supported_collation_set_test.rb +34 -0
- data/test/card_dav/xml/request/address_book_query_report_test.rb +276 -0
- data/test/dav/abstract_server.rb +36 -0
- data/test/dav/auth/backend/abstract_basic_test.rb +74 -0
- data/test/dav/auth/backend/abstract_digest_test.rb +114 -0
- data/test/dav/auth/backend/abstract_sequel_test.rb +25 -0
- data/test/dav/auth/backend/apache_test.rb +60 -0
- data/test/dav/auth/backend/basic_call_back_test.rb +33 -0
- data/test/dav/auth/backend/file_test.rb +43 -0
- data/test/dav/auth/backend/mock.rb +73 -0
- data/test/dav/auth/backend/sequel_my_sql_test.rb +32 -0
- data/test/dav/auth/backend/sequel_sqlite_test.rb +21 -0
- data/test/dav/auth/plugin_test.rb +92 -0
- data/test/dav/basic_node_test.rb +143 -0
- data/test/dav/browser/guess_content_type_test.rb +44 -0
- data/test/dav/browser/map_get_to_prop_find_test.rb +37 -0
- data/test/dav/browser/plugin_test.rb +165 -0
- data/test/dav/browser/prop_find_all_test.rb +59 -0
- data/test/dav/client_mock.rb +24 -0
- data/test/dav/client_test.rb +231 -0
- data/test/dav/copy_test.rb +33 -0
- data/test/dav/exception/locked_test.rb +61 -0
- data/test/dav/exception/payment_required_test.rb +14 -0
- data/test/dav/exception/service_unavailable_test.rb +14 -0
- data/test/dav/exception/too_many_matches_test.rb +31 -0
- data/test/dav/exception_test.rb +24 -0
- data/test/dav/fs_ext/file_test.rb +72 -0
- data/test/dav/fs_ext/server_test.rb +251 -0
- data/test/dav/get_if_conditions_test.rb +299 -0
- data/test/dav/http_delete_test.rb +110 -0
- data/test/dav/http_get_test.rb +130 -0
- data/test/dav/http_head_test.rb +80 -0
- data/test/dav/http_move_test.rb +105 -0
- data/test/dav/http_prefer_parsing_test.rb +186 -0
- data/test/dav/http_put_test.rb +271 -0
- data/test/dav/issue33_test.rb +90 -0
- data/test/dav/locks/backend/abstract_test.rb +160 -0
- data/test/dav/locks/backend/file_test.rb +24 -0
- data/test/dav/locks/backend/mock.rb +82 -0
- data/test/dav/locks/backend/sequel_my_sql_test.rb +32 -0
- data/test/dav/locks/backend/sequel_test.rb +19 -0
- data/test/dav/locks/ms_word_test.rb +119 -0
- data/test/dav/locks/plugin2_test.rb +61 -0
- data/test/dav/locks/plugin_test.rb +896 -0
- data/test/dav/mock/collection.rb +113 -0
- data/test/dav/mock/file.rb +100 -0
- data/test/dav/mock/properties_collection.rb +80 -0
- data/test/dav/mock/streaming_file.rb +66 -0
- data/test/dav/mount/plugin_test.rb +48 -0
- data/test/dav/object_tree_test.rb +65 -0
- data/test/dav/partial_update/file_mock.rb +92 -0
- data/test/dav/partial_update/plugin_test.rb +125 -0
- data/test/dav/partial_update/specification_test.rb +77 -0
- data/test/dav/prop_find_test.rb +87 -0
- data/test/dav/prop_patch_test.rb +367 -0
- data/test/dav/property_storage/backend/abstract_sequel_test.rb +147 -0
- data/test/dav/property_storage/backend/mock.rb +96 -0
- data/test/dav/property_storage/backend/sequel_mysql_test.rb +32 -0
- data/test/dav/property_storage/backend/sequel_sqlite_test.rb +31 -0
- data/test/dav/property_storage/plugin_test.rb +90 -0
- data/test/dav/server_copy_move_test.rb +164 -0
- data/test/dav/server_events_test.rb +105 -0
- data/test/dav/server_mkcol_test.rb +337 -0
- data/test/dav/server_mock.rb +10 -0
- data/test/dav/server_plugin_test.rb +85 -0
- data/test/dav/server_precondition_test.rb +253 -0
- data/test/dav/server_props_infinite_depth_test.rb +144 -0
- data/test/dav/server_props_test.rb +182 -0
- data/test/dav/server_range_test.rb +262 -0
- data/test/dav/server_simple_test.rb +388 -0
- data/test/dav/server_update_properties_test.rb +93 -0
- data/test/dav/simple_file_test.rb +17 -0
- data/test/dav/string_util_test.rb +92 -0
- data/test/dav/sync/mock_sync_collection.rb +141 -0
- data/test/dav/sync/plugin_test.rb +491 -0
- data/test/dav/sync_token_property_test.rb +105 -0
- data/test/dav/temporary_file_filter_test.rb +179 -0
- data/test/dav/test_plugin.rb +24 -0
- data/test/dav/tree_test.rb +201 -0
- data/test/dav/uuid_util_test.rb +14 -0
- data/test/dav/xml/element/prop_test.rb +121 -0
- data/test/dav/xml/element/response_test.rb +202 -0
- data/test/dav/xml/property/href_test.rb +112 -0
- data/test/dav/xml/property/last_modified_test.rb +52 -0
- data/test/dav/xml/property/lock_discovery_test.rb +79 -0
- data/test/dav/xml/property/supported_method_set_test.rb +54 -0
- data/test/dav/xml/property/supported_report_set_test.rb +109 -0
- data/test/dav/xml/request/prop_find_test.rb +45 -0
- data/test/dav/xml/request/prop_patch_test.rb +47 -0
- data/test/dav/xml/request/sync_collection_test.rb +89 -0
- data/test/dav/xml/xml_tester.rb +35 -0
- data/test/dav_acl/acl_method_test.rb +299 -0
- data/test/dav_acl/allow_access_test.rb +94 -0
- data/test/dav_acl/block_access_test.rb +161 -0
- data/test/dav_acl/exception/ace_conflict_test.rb +33 -0
- data/test/dav_acl/exception/need_privileges_exception_test.rb +43 -0
- data/test/dav_acl/exception/no_abstract_test.rb +33 -0
- data/test/dav_acl/exception/not_recognized_principal_test.rb +33 -0
- data/test/dav_acl/exception/not_supported_privilege_test.rb +33 -0
- data/test/dav_acl/expand_properties_test.rb +265 -0
- data/test/dav_acl/fs/collection_test.rb +39 -0
- data/test/dav_acl/fs/file_test.rb +47 -0
- data/test/dav_acl/fs/home_collection_test.rb +82 -0
- data/test/dav_acl/mock_acl_node.rb +27 -0
- data/test/dav_acl/mock_principal.rb +27 -0
- data/test/dav_acl/plugin_admin_test.rb +60 -0
- data/test/dav_acl/plugin_properties_test.rb +346 -0
- data/test/dav_acl/plugin_update_properties_test.rb +82 -0
- data/test/dav_acl/principal_backend/abstract_sequel_test.rb +159 -0
- data/test/dav_acl/principal_backend/mock.rb +150 -0
- data/test/dav_acl/principal_backend/sequel_my_sql_test.rb +43 -0
- data/test/dav_acl/principal_backend/sequel_sqlite_test.rb +31 -0
- data/test/dav_acl/principal_collection_test.rb +44 -0
- data/test/dav_acl/principal_property_search_test.rb +354 -0
- data/test/dav_acl/principal_search_property_set_test.rb +125 -0
- data/test/dav_acl/principal_test.rb +181 -0
- data/test/dav_acl/simple_plugin_test.rb +320 -0
- data/test/dav_acl/xml/property/acl_restrictions_test.rb +28 -0
- data/test/dav_acl/xml/property/acl_test.rb +325 -0
- data/test/dav_acl/xml/property/current_user_privilege_set_test.rb +77 -0
- data/test/dav_acl/xml/property/principal_test.rb +158 -0
- data/test/dav_acl/xml/property/supported_privilege_set_test.rb +109 -0
- data/test/dav_server_test.rb +225 -0
- data/test/http/response_mock.rb +16 -0
- data/test/http/sapi_mock.rb +29 -0
- data/test/test_helper.rb +176 -0
- data/tilia-dav.gemspec +28 -0
- metadata +726 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
module Tilia
|
2
|
+
module DavAcl
|
3
|
+
module Xml
|
4
|
+
module Request
|
5
|
+
# PrincipalSearchPropertySetReport request parser.
|
6
|
+
#
|
7
|
+
# This class parses the {DAV:}principal-search-property-set REPORT, as defined
|
8
|
+
# in:
|
9
|
+
#
|
10
|
+
# https://tools.ietf.org/html/rfc3744#section-9.5
|
11
|
+
#
|
12
|
+
# @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
|
13
|
+
# @author Evert Pot (http://evertpot.com/)
|
14
|
+
# @license http://sabre.io/license/ Modified BSD License
|
15
|
+
class PrincipalSearchPropertySetReport
|
16
|
+
include Tilia::Xml::XmlDeserializable
|
17
|
+
|
18
|
+
# The deserialize method is called during xml parsing.
|
19
|
+
#
|
20
|
+
# This method is called statictly, this is because in theory this method
|
21
|
+
# may be used as a type of constructor, or factory method.
|
22
|
+
#
|
23
|
+
# Often you want to return an instance of the current class, but you are
|
24
|
+
# free to return other data as well.
|
25
|
+
#
|
26
|
+
# You are responsible for advancing the reader to the next element. Not
|
27
|
+
# doing anything will result in a never-ending loop.
|
28
|
+
#
|
29
|
+
# If you just want to skip parsing for this element altogether, you can
|
30
|
+
# just call reader.next
|
31
|
+
#
|
32
|
+
# reader.parse_inner_tree will parse the entire sub-tree, and advance to
|
33
|
+
# the next element.
|
34
|
+
#
|
35
|
+
# @param Reader reader
|
36
|
+
# @return mixed
|
37
|
+
def self.xml_deserialize(reader)
|
38
|
+
fail Dav::Exception::BadRequest, 'The {DAV:}principal-search-property-set element must be empty' unless reader.empty_element?
|
39
|
+
|
40
|
+
# The element is actually empty, so there's not much to do.
|
41
|
+
reader.next
|
42
|
+
|
43
|
+
new
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,817 @@
|
|
1
|
+
module Tilia
|
2
|
+
module CalDav
|
3
|
+
module Backend
|
4
|
+
module AbstractSequelTest
|
5
|
+
def setup
|
6
|
+
@sequel = sequel
|
7
|
+
@backend = Sequel.new(@sequel)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_get_calendars_for_user_no_calendars
|
11
|
+
calendars = @backend.calendars_for_user('principals/user2')
|
12
|
+
assert_equal([], calendars)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_create_calendar_and_fetch
|
16
|
+
returned_id = @backend.create_calendar(
|
17
|
+
'principals/user2',
|
18
|
+
'somerandomid',
|
19
|
+
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => Xml::Property::SupportedCalendarComponentSet.new(['VEVENT']),
|
20
|
+
'{DAV:}displayname' => 'Hello!',
|
21
|
+
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => Xml::Property::ScheduleCalendarTransp.new('transparent')
|
22
|
+
)
|
23
|
+
calendars = @backend.calendars_for_user('principals/user2')
|
24
|
+
|
25
|
+
element_check = {
|
26
|
+
'id' => returned_id,
|
27
|
+
'uri' => 'somerandomid',
|
28
|
+
'{DAV:}displayname' => 'Hello!',
|
29
|
+
'{urn:ietf:params:xml:ns:caldav}calendar-description' => nil,
|
30
|
+
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => Xml::Property::ScheduleCalendarTransp.new('transparent')
|
31
|
+
}
|
32
|
+
|
33
|
+
assert_kind_of(Array, calendars)
|
34
|
+
assert_equal(1, calendars.size)
|
35
|
+
|
36
|
+
element_check.each do |name, value|
|
37
|
+
assert_has_key(name, calendars[0])
|
38
|
+
assert_instance_equal(value, calendars[0][name])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_update_calendar_and_fetch
|
43
|
+
# Creating a new calendar
|
44
|
+
new_id = @backend.create_calendar(
|
45
|
+
'principals/user2',
|
46
|
+
'somerandomid',
|
47
|
+
{}
|
48
|
+
)
|
49
|
+
|
50
|
+
prop_patch = Dav::PropPatch.new(
|
51
|
+
'{DAV:}displayname' => 'myCalendar',
|
52
|
+
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => Xml::Property::ScheduleCalendarTransp.new('transparent')
|
53
|
+
)
|
54
|
+
|
55
|
+
# Updating the calendar
|
56
|
+
@backend.update_calendar(new_id, prop_patch)
|
57
|
+
result = prop_patch.commit
|
58
|
+
|
59
|
+
# Verifying the result of the update
|
60
|
+
assert(result)
|
61
|
+
|
62
|
+
# Fetching all calendars from this user
|
63
|
+
calendars = @backend.calendars_for_user('principals/user2')
|
64
|
+
|
65
|
+
# Checking if all the information is still correct
|
66
|
+
element_check = {
|
67
|
+
'id' => new_id,
|
68
|
+
'uri' => 'somerandomid',
|
69
|
+
'{DAV:}displayname' => 'myCalendar',
|
70
|
+
'{urn:ietf:params:xml:ns:caldav}calendar-description' => nil,
|
71
|
+
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => nil,
|
72
|
+
'{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/2',
|
73
|
+
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => Xml::Property::ScheduleCalendarTransp.new('transparent')
|
74
|
+
}
|
75
|
+
|
76
|
+
assert_kind_of(Array, calendars)
|
77
|
+
assert_equal(1, calendars.size)
|
78
|
+
|
79
|
+
element_check.each do |name, value|
|
80
|
+
assert_has_key(name, calendars[0])
|
81
|
+
assert_instance_equal(value, calendars[0][name])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_update_calendar_unknown_property
|
86
|
+
# Creating a new calendar
|
87
|
+
new_id = @backend.create_calendar(
|
88
|
+
'principals/user2',
|
89
|
+
'somerandomid',
|
90
|
+
{}
|
91
|
+
)
|
92
|
+
|
93
|
+
prop_patch = Dav::PropPatch.new(
|
94
|
+
'{DAV:}displayname' => 'myCalendar',
|
95
|
+
'{DAV:}yourmom' => 'wittycomment'
|
96
|
+
)
|
97
|
+
|
98
|
+
# Updating the calendar
|
99
|
+
@backend.update_calendar(new_id, prop_patch)
|
100
|
+
prop_patch.commit
|
101
|
+
|
102
|
+
# Verifying the result of the update
|
103
|
+
assert_equal(
|
104
|
+
{
|
105
|
+
'{DAV:}yourmom' => 403,
|
106
|
+
'{DAV:}displayname' => 424
|
107
|
+
},
|
108
|
+
prop_patch.result
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_delete_calendar
|
113
|
+
returned_id = @backend.create_calendar(
|
114
|
+
'principals/user2',
|
115
|
+
'somerandomid',
|
116
|
+
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => Xml::Property::SupportedCalendarComponentSet.new(['VEVENT']),
|
117
|
+
'{DAV:}displayname' => 'Hello!'
|
118
|
+
)
|
119
|
+
|
120
|
+
@backend.delete_calendar(returned_id)
|
121
|
+
|
122
|
+
calendars = @backend.calendars_for_user('principals/user2')
|
123
|
+
assert_equal([], calendars)
|
124
|
+
end
|
125
|
+
|
126
|
+
# @expectedException \Sabre\DAV\Exception
|
127
|
+
def test_create_calendar_incorrect_component_set
|
128
|
+
# Creating a new calendar
|
129
|
+
assert_raises(Dav::Exception) do
|
130
|
+
new_id = @backend.create_calendar(
|
131
|
+
'principals/user2',
|
132
|
+
'somerandomid',
|
133
|
+
'{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => 'blabla'
|
134
|
+
)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_create_calendar_object
|
139
|
+
returned_id = @backend.create_calendar(
|
140
|
+
'principals/user2',
|
141
|
+
'somerandomid',
|
142
|
+
{}
|
143
|
+
)
|
144
|
+
|
145
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
146
|
+
|
147
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
148
|
+
|
149
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
150
|
+
|
151
|
+
assert_equal(
|
152
|
+
{
|
153
|
+
etag: Digest::MD5.hexdigest(object),
|
154
|
+
size: object.bytesize,
|
155
|
+
calendardata: object,
|
156
|
+
firstoccurence: Time.zone.parse('20120101').to_i,
|
157
|
+
lastoccurence: (Time.zone.parse('20120101') + 1.day).to_i,
|
158
|
+
componenttype: 'VEVENT'
|
159
|
+
},
|
160
|
+
row
|
161
|
+
)
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_get_multiple_objects
|
165
|
+
returned_id = @backend.create_calendar(
|
166
|
+
'principals/user2',
|
167
|
+
'somerandomid',
|
168
|
+
{}
|
169
|
+
)
|
170
|
+
|
171
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
172
|
+
|
173
|
+
@backend.create_calendar_object(returned_id, 'id-1', object)
|
174
|
+
@backend.create_calendar_object(returned_id, 'id-2', object)
|
175
|
+
|
176
|
+
check = [
|
177
|
+
{
|
178
|
+
'id' => 1,
|
179
|
+
'etag' => "\"#{Digest::MD5.hexdigest(object)}\"",
|
180
|
+
'uri' => 'id-1',
|
181
|
+
'size' => object.bytesize,
|
182
|
+
'calendardata' => object,
|
183
|
+
'lastmodified' => nil,
|
184
|
+
'calendarid' => returned_id
|
185
|
+
},
|
186
|
+
{
|
187
|
+
'id' => 2,
|
188
|
+
'etag' => "\"#{Digest::MD5.hexdigest(object)}\"",
|
189
|
+
'uri' => 'id-2',
|
190
|
+
'size' => object.bytesize,
|
191
|
+
'calendardata' => object,
|
192
|
+
'lastmodified' => nil,
|
193
|
+
'calendarid' => returned_id
|
194
|
+
}
|
195
|
+
]
|
196
|
+
|
197
|
+
result = @backend.multiple_calendar_objects(returned_id, ['id-1', 'id-2'])
|
198
|
+
|
199
|
+
check.each_with_index do |props, index|
|
200
|
+
props.each do |key, value|
|
201
|
+
if key != 'lastmodified'
|
202
|
+
assert_equal(value, result[index][key])
|
203
|
+
else
|
204
|
+
assert_has_key(key, result[index])
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_create_calendar_object_no_component
|
211
|
+
returned_id = @backend.create_calendar(
|
212
|
+
'principals/user2',
|
213
|
+
'somerandomid',
|
214
|
+
{}
|
215
|
+
)
|
216
|
+
|
217
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nEND:VCALENDAR\r\n"
|
218
|
+
|
219
|
+
assert_raises(Dav::Exception::BadRequest) do
|
220
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_create_calendar_object_duration
|
225
|
+
returned_id = @backend.create_calendar(
|
226
|
+
'principals/user2',
|
227
|
+
'somerandomid',
|
228
|
+
{}
|
229
|
+
)
|
230
|
+
|
231
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nDURATION:P2D\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
232
|
+
|
233
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
234
|
+
|
235
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
236
|
+
assert_equal(
|
237
|
+
{
|
238
|
+
etag: Digest::MD5.hexdigest(object),
|
239
|
+
size: object.bytesize,
|
240
|
+
calendardata: object,
|
241
|
+
firstoccurence: Time.zone.parse('20120101').to_i,
|
242
|
+
lastoccurence: (Time.zone.parse('20120101') + 2.days).to_i,
|
243
|
+
componenttype: 'VEVENT'
|
244
|
+
},
|
245
|
+
row
|
246
|
+
)
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_create_calendar_object_no_dtend
|
250
|
+
returned_id = @backend.create_calendar(
|
251
|
+
'principals/user2',
|
252
|
+
'somerandomid',
|
253
|
+
{}
|
254
|
+
)
|
255
|
+
|
256
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
257
|
+
|
258
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
259
|
+
|
260
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
261
|
+
assert_equal(
|
262
|
+
{
|
263
|
+
etag: Digest::MD5.hexdigest(object),
|
264
|
+
size: object.bytesize,
|
265
|
+
calendardata: object,
|
266
|
+
firstoccurence: Time.zone.parse('2012-01-01 10:00:00').to_i,
|
267
|
+
lastoccurence: Time.zone.parse('2012-01-01 10:00:00').to_i,
|
268
|
+
componenttype: 'VEVENT'
|
269
|
+
},
|
270
|
+
row
|
271
|
+
)
|
272
|
+
end
|
273
|
+
|
274
|
+
def test_create_calendar_object_with_dtend
|
275
|
+
returned_id = @backend.create_calendar(
|
276
|
+
'principals/user2',
|
277
|
+
'somerandomid',
|
278
|
+
{}
|
279
|
+
)
|
280
|
+
|
281
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND:20120101T110000Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
282
|
+
|
283
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
284
|
+
|
285
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
286
|
+
assert_equal(
|
287
|
+
{
|
288
|
+
etag: Digest::MD5.hexdigest(object),
|
289
|
+
size: object.bytesize,
|
290
|
+
calendardata: object,
|
291
|
+
firstoccurence: Time.zone.parse('2012-01-01 10:00:00').to_i,
|
292
|
+
lastoccurence: Time.zone.parse('2012-01-01 11:00:00').to_i,
|
293
|
+
componenttype: 'VEVENT'
|
294
|
+
},
|
295
|
+
row
|
296
|
+
)
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_create_calendar_object_infinite_reccurence
|
300
|
+
returned_id = @backend.create_calendar(
|
301
|
+
'principals/user2',
|
302
|
+
'somerandomid',
|
303
|
+
{}
|
304
|
+
)
|
305
|
+
|
306
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nRRULE:FREQ=DAILY\r\nUID:foo\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
307
|
+
|
308
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
309
|
+
|
310
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
311
|
+
assert_equal(
|
312
|
+
{
|
313
|
+
etag: Digest::MD5.hexdigest(object),
|
314
|
+
size: object.bytesize,
|
315
|
+
calendardata: object,
|
316
|
+
firstoccurence: Time.zone.parse('2012-01-01 10:00:00').to_i,
|
317
|
+
lastoccurence: Time.zone.parse(Sequel::MAX_DATE).to_i,
|
318
|
+
componenttype: 'VEVENT'
|
319
|
+
},
|
320
|
+
row
|
321
|
+
)
|
322
|
+
end
|
323
|
+
|
324
|
+
def test_create_calendar_object_ending_reccurence
|
325
|
+
returned_id = @backend.create_calendar(
|
326
|
+
'principals/user2',
|
327
|
+
'somerandomid',
|
328
|
+
{}
|
329
|
+
)
|
330
|
+
|
331
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE-TIME:20120101T100000Z\r\nDTEND;VALUE=DATE-TIME:20120101T110000Z\r\nUID:foo\r\nRRULE:FREQ=DAILY;COUNT=1000\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
332
|
+
|
333
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
334
|
+
|
335
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
336
|
+
assert_equal(
|
337
|
+
{
|
338
|
+
etag: Digest::MD5.hexdigest(object),
|
339
|
+
size: object.bytesize,
|
340
|
+
calendardata: object,
|
341
|
+
firstoccurence: Time.zone.parse('2012-01-01 10:00:00').to_i,
|
342
|
+
lastoccurence: (Time.zone.parse('2012-01-01 11:00:00') + 999.days).to_i,
|
343
|
+
componenttype: 'VEVENT'
|
344
|
+
},
|
345
|
+
row
|
346
|
+
)
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_create_calendar_object_task
|
350
|
+
returned_id = @backend.create_calendar(
|
351
|
+
'principals/user2',
|
352
|
+
'somerandomid',
|
353
|
+
{}
|
354
|
+
)
|
355
|
+
|
356
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nDUE;VALUE=DATE-TIME:20120101T100000Z\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"
|
357
|
+
|
358
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
359
|
+
|
360
|
+
row = @sequel['SELECT etag, size, calendardata, firstoccurence, lastoccurence, componenttype FROM calendarobjects WHERE uri = "random-id"'].all.first
|
361
|
+
assert_equal(
|
362
|
+
{
|
363
|
+
etag: Digest::MD5.hexdigest(object),
|
364
|
+
size: object.bytesize,
|
365
|
+
calendardata: object,
|
366
|
+
firstoccurence: nil,
|
367
|
+
lastoccurence: nil,
|
368
|
+
componenttype: 'VTODO'
|
369
|
+
},
|
370
|
+
row
|
371
|
+
)
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_get_calendar_objects
|
375
|
+
returned_id = @backend.create_calendar(
|
376
|
+
'principals/user2',
|
377
|
+
'somerandomid',
|
378
|
+
{}
|
379
|
+
)
|
380
|
+
|
381
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
382
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
383
|
+
|
384
|
+
data = @backend.calendar_objects(returned_id)
|
385
|
+
|
386
|
+
assert_equal(1, data.size)
|
387
|
+
data = data[0]
|
388
|
+
|
389
|
+
assert_equal(returned_id, data['calendarid'])
|
390
|
+
assert_equal('random-id', data['uri'])
|
391
|
+
assert_equal(object.bytesize, data['size'])
|
392
|
+
end
|
393
|
+
|
394
|
+
def test_get_calendar_object_by_uid
|
395
|
+
returned_id = @backend.create_calendar('principals/user2', 'somerandomid', {})
|
396
|
+
|
397
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nUID:foo\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
398
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
399
|
+
|
400
|
+
assert_nil(@backend.calendar_object_by_uid('principals/user2', 'bar'))
|
401
|
+
assert_equal(
|
402
|
+
'somerandomid/random-id',
|
403
|
+
@backend.calendar_object_by_uid('principals/user2', 'foo')
|
404
|
+
)
|
405
|
+
end
|
406
|
+
|
407
|
+
def test_update_calendar_object
|
408
|
+
returned_id = @backend.create_calendar(
|
409
|
+
'principals/user2',
|
410
|
+
'somerandomid',
|
411
|
+
{}
|
412
|
+
)
|
413
|
+
|
414
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
415
|
+
object2 = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20130101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
416
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
417
|
+
@backend.update_calendar_object(returned_id, 'random-id', object2)
|
418
|
+
|
419
|
+
data = @backend.calendar_object(returned_id, 'random-id')
|
420
|
+
|
421
|
+
assert_equal(object2, data['calendardata'])
|
422
|
+
assert_equal(returned_id, data['calendarid'])
|
423
|
+
assert_equal('random-id', data['uri'])
|
424
|
+
end
|
425
|
+
|
426
|
+
def test_delete_calendar_object
|
427
|
+
returned_id = @backend.create_calendar(
|
428
|
+
'principals/user2',
|
429
|
+
'somerandomid',
|
430
|
+
{}
|
431
|
+
)
|
432
|
+
|
433
|
+
object = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"
|
434
|
+
@backend.create_calendar_object(returned_id, 'random-id', object)
|
435
|
+
@backend.delete_calendar_object(returned_id, 'random-id')
|
436
|
+
|
437
|
+
data = @backend.calendar_object(returned_id, 'random-id')
|
438
|
+
assert_nil(data)
|
439
|
+
end
|
440
|
+
|
441
|
+
def test_calendar_query_no_result
|
442
|
+
filters = {
|
443
|
+
'name' => 'VCALENDAR',
|
444
|
+
'comp-filters' => [
|
445
|
+
{
|
446
|
+
'name' => 'VJOURNAL',
|
447
|
+
'comp-filters' => [],
|
448
|
+
'prop-filters' => [],
|
449
|
+
'is-not-defined' => false,
|
450
|
+
'time-range' => nil
|
451
|
+
}
|
452
|
+
],
|
453
|
+
'prop-filters' => [],
|
454
|
+
'is-not-defined' => false,
|
455
|
+
'time-range' => nil
|
456
|
+
}
|
457
|
+
|
458
|
+
assert_equal([], @backend.calendar_query(1, filters))
|
459
|
+
end
|
460
|
+
|
461
|
+
def test_calendar_query_todo
|
462
|
+
@backend.create_calendar_object(1, 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
|
463
|
+
@backend.create_calendar_object(1, 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
464
|
+
|
465
|
+
filters = {
|
466
|
+
'name' => 'VCALENDAR',
|
467
|
+
'comp-filters' => [
|
468
|
+
{
|
469
|
+
'name' => 'VTODO',
|
470
|
+
'comp-filters' => [],
|
471
|
+
'prop-filters' => [],
|
472
|
+
'is-not-defined' => false,
|
473
|
+
'time-range' => nil
|
474
|
+
}
|
475
|
+
],
|
476
|
+
'prop-filters' => [],
|
477
|
+
'is-not-defined' => false,
|
478
|
+
'time-range' => nil
|
479
|
+
}
|
480
|
+
|
481
|
+
assert_equal(['todo'], @backend.calendar_query(1, filters))
|
482
|
+
end
|
483
|
+
|
484
|
+
def test_calendar_query_todo_not_match
|
485
|
+
@backend.create_calendar_object(1, 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
|
486
|
+
@backend.create_calendar_object(1, 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
487
|
+
|
488
|
+
filters = {
|
489
|
+
'name' => 'VCALENDAR',
|
490
|
+
'comp-filters' => [
|
491
|
+
{
|
492
|
+
'name' => 'VTODO',
|
493
|
+
'comp-filters' => [],
|
494
|
+
'prop-filters' => [
|
495
|
+
{
|
496
|
+
'name' => 'summary',
|
497
|
+
'text-match' => nil,
|
498
|
+
'time-range' => nil,
|
499
|
+
'param-filters' => [],
|
500
|
+
'is-not-defined' => false
|
501
|
+
}
|
502
|
+
],
|
503
|
+
'is-not-defined' => false,
|
504
|
+
'time-range' => nil
|
505
|
+
}
|
506
|
+
],
|
507
|
+
'prop-filters' => [],
|
508
|
+
'is-not-defined' => false,
|
509
|
+
'time-range' => nil
|
510
|
+
}
|
511
|
+
|
512
|
+
assert_equal([], @backend.calendar_query(1, filters))
|
513
|
+
end
|
514
|
+
|
515
|
+
def test_calendar_query_no_filter
|
516
|
+
@backend.create_calendar_object(1, 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
|
517
|
+
@backend.create_calendar_object(1, 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
518
|
+
|
519
|
+
filters = {
|
520
|
+
'name' => 'VCALENDAR',
|
521
|
+
'comp-filters' => [],
|
522
|
+
'prop-filters' => [],
|
523
|
+
'is-not-defined' => false,
|
524
|
+
'time-range' => nil
|
525
|
+
}
|
526
|
+
|
527
|
+
result = @backend.calendar_query(1, filters)
|
528
|
+
assert(result.include?('todo'))
|
529
|
+
assert(result.include?('event'))
|
530
|
+
end
|
531
|
+
|
532
|
+
def test_calendar_query_time_range
|
533
|
+
@backend.create_calendar_object(1, 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
|
534
|
+
@backend.create_calendar_object(1, 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
535
|
+
@backend.create_calendar_object(1, 'event2', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART;VALUE=DATE:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
536
|
+
|
537
|
+
filters = {
|
538
|
+
'name' => 'VCALENDAR',
|
539
|
+
'comp-filters' => [
|
540
|
+
{
|
541
|
+
'name' => 'VEVENT',
|
542
|
+
'comp-filters' => [],
|
543
|
+
'prop-filters' => [],
|
544
|
+
'is-not-defined' => false,
|
545
|
+
'time-range' => {
|
546
|
+
'start' => Time.zone.parse('20120103'),
|
547
|
+
'end' => Time.zone.parse('20120104')
|
548
|
+
}
|
549
|
+
}
|
550
|
+
],
|
551
|
+
'prop-filters' => [],
|
552
|
+
'is-not-defined' => false,
|
553
|
+
'time-range' => nil
|
554
|
+
}
|
555
|
+
|
556
|
+
assert_equal(
|
557
|
+
['event2'],
|
558
|
+
@backend.calendar_query(1, filters)
|
559
|
+
)
|
560
|
+
end
|
561
|
+
|
562
|
+
def test_calendar_query_time_range_no_end
|
563
|
+
@backend.create_calendar_object(1, 'todo', "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n")
|
564
|
+
@backend.create_calendar_object(1, 'event', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120101\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
565
|
+
@backend.create_calendar_object(1, 'event2', "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20120103\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n")
|
566
|
+
|
567
|
+
filters = {
|
568
|
+
'name' => 'VCALENDAR',
|
569
|
+
'comp-filters' => [
|
570
|
+
{
|
571
|
+
'name' => 'VEVENT',
|
572
|
+
'comp-filters' => [],
|
573
|
+
'prop-filters' => [],
|
574
|
+
'is-not-defined' => false,
|
575
|
+
'time-range' => {
|
576
|
+
'start' => Time.zone.parse('20120102'),
|
577
|
+
'end' => nil
|
578
|
+
}
|
579
|
+
}
|
580
|
+
],
|
581
|
+
'prop-filters' => [],
|
582
|
+
'is-not-defined' => false,
|
583
|
+
'time-range' => nil
|
584
|
+
}
|
585
|
+
|
586
|
+
assert_equal(
|
587
|
+
['event2'],
|
588
|
+
@backend.calendar_query(1, filters)
|
589
|
+
)
|
590
|
+
end
|
591
|
+
|
592
|
+
def test_get_changes
|
593
|
+
id = @backend.create_calendar(
|
594
|
+
'principals/user1',
|
595
|
+
'bla',
|
596
|
+
{}
|
597
|
+
)
|
598
|
+
|
599
|
+
result = @backend.changes_for_calendar(id, nil, 1)
|
600
|
+
|
601
|
+
assert_equal(
|
602
|
+
{
|
603
|
+
'syncToken' => 1,
|
604
|
+
'modified' => [],
|
605
|
+
'deleted' => [],
|
606
|
+
'added' => []
|
607
|
+
},
|
608
|
+
result
|
609
|
+
)
|
610
|
+
|
611
|
+
current_token = result['syncToken']
|
612
|
+
|
613
|
+
dummy_todo = "BEGIN:VCALENDAR\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n"
|
614
|
+
|
615
|
+
@backend.create_calendar_object(id, 'todo1.ics', dummy_todo)
|
616
|
+
@backend.create_calendar_object(id, 'todo2.ics', dummy_todo)
|
617
|
+
@backend.create_calendar_object(id, 'todo3.ics', dummy_todo)
|
618
|
+
@backend.update_calendar_object(id, 'todo1.ics', dummy_todo)
|
619
|
+
@backend.delete_calendar_object(id, 'todo2.ics')
|
620
|
+
|
621
|
+
result = @backend.changes_for_calendar(id, current_token, 1)
|
622
|
+
|
623
|
+
assert_equal(
|
624
|
+
{
|
625
|
+
'syncToken' => 6,
|
626
|
+
'modified' => ['todo1.ics'],
|
627
|
+
'deleted' => ['todo2.ics'],
|
628
|
+
'added' => ['todo3.ics']
|
629
|
+
},
|
630
|
+
result
|
631
|
+
)
|
632
|
+
|
633
|
+
result = @backend.changes_for_calendar(id, nil, 1)
|
634
|
+
|
635
|
+
assert_equal(
|
636
|
+
{
|
637
|
+
'syncToken' => 6,
|
638
|
+
'modified' => [],
|
639
|
+
'deleted' => [],
|
640
|
+
'added' => ['todo1.ics', 'todo3.ics']
|
641
|
+
},
|
642
|
+
result
|
643
|
+
)
|
644
|
+
end
|
645
|
+
|
646
|
+
def test_create_subscriptions
|
647
|
+
props = {
|
648
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal.ics', false),
|
649
|
+
'{DAV:}displayname' => 'cal',
|
650
|
+
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
|
651
|
+
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
|
652
|
+
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
|
653
|
+
# '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
|
654
|
+
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true
|
655
|
+
}
|
656
|
+
|
657
|
+
@backend.create_subscription('principals/user1', 'sub1', props)
|
658
|
+
|
659
|
+
subs = @backend.subscriptions_for_user('principals/user1')
|
660
|
+
|
661
|
+
expected = props
|
662
|
+
expected['id'] = 1
|
663
|
+
expected['uri'] = 'sub1'
|
664
|
+
expected['principaluri'] = 'principals/user1'
|
665
|
+
|
666
|
+
expected.delete('{http://calendarserver.org/ns/}source')
|
667
|
+
expected['source'] = 'http://example.org/cal.ics'
|
668
|
+
|
669
|
+
assert_equal(1, subs.size)
|
670
|
+
expected.each do |k, _v|
|
671
|
+
assert_equal(subs[0][k], expected[k])
|
672
|
+
end
|
673
|
+
end
|
674
|
+
|
675
|
+
def test_create_subscription_fail
|
676
|
+
props = {}
|
677
|
+
|
678
|
+
assert_raises(Dav::Exception::Forbidden) do
|
679
|
+
@backend.create_subscription('principals/user1', 'sub1', props)
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
683
|
+
def test_update_subscriptions
|
684
|
+
props = {
|
685
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal.ics', false),
|
686
|
+
'{DAV:}displayname' => 'cal',
|
687
|
+
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
|
688
|
+
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
|
689
|
+
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
|
690
|
+
# '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
|
691
|
+
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true
|
692
|
+
}
|
693
|
+
|
694
|
+
@backend.create_subscription('principals/user1', 'sub1', props)
|
695
|
+
|
696
|
+
new_props = {
|
697
|
+
'{DAV:}displayname' => 'new displayname',
|
698
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal2.ics', false)
|
699
|
+
}
|
700
|
+
|
701
|
+
prop_patch = Dav::PropPatch.new(new_props)
|
702
|
+
@backend.update_subscription(1, prop_patch)
|
703
|
+
result = prop_patch.commit
|
704
|
+
|
705
|
+
assert(result)
|
706
|
+
|
707
|
+
subs = @backend.subscriptions_for_user('principals/user1')
|
708
|
+
|
709
|
+
expected = props.merge(new_props)
|
710
|
+
expected['id'] = 1
|
711
|
+
expected['uri'] = 'sub1'
|
712
|
+
expected['principaluri'] = 'principals/user1'
|
713
|
+
|
714
|
+
expected.delete('{http://calendarserver.org/ns/}source')
|
715
|
+
expected['source'] = 'http://example.org/cal2.ics'
|
716
|
+
|
717
|
+
assert_equal(1, subs.size)
|
718
|
+
expected.each do |k, _v|
|
719
|
+
assert_equal(subs[0][k], expected[k])
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
def test_update_subscriptions_fail
|
724
|
+
props = {
|
725
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal.ics', false),
|
726
|
+
'{DAV:}displayname' => 'cal',
|
727
|
+
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
|
728
|
+
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
|
729
|
+
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
|
730
|
+
# '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
|
731
|
+
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true
|
732
|
+
}
|
733
|
+
|
734
|
+
@backend.create_subscription('principals/user1', 'sub1', props)
|
735
|
+
|
736
|
+
prop_patch = Dav::PropPatch.new(
|
737
|
+
'{DAV:}displayname' => 'new displayname',
|
738
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal2.ics', false),
|
739
|
+
'{DAV:}unknown' => 'foo'
|
740
|
+
)
|
741
|
+
|
742
|
+
@backend.update_subscription(1, prop_patch)
|
743
|
+
prop_patch.commit
|
744
|
+
|
745
|
+
assert_equal(
|
746
|
+
{
|
747
|
+
'{DAV:}unknown' => 403,
|
748
|
+
'{DAV:}displayname' => 424,
|
749
|
+
'{http://calendarserver.org/ns/}source' => 424
|
750
|
+
},
|
751
|
+
prop_patch.result
|
752
|
+
)
|
753
|
+
end
|
754
|
+
|
755
|
+
def test_delete_subscriptions
|
756
|
+
props = {
|
757
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal.ics', false),
|
758
|
+
'{DAV:}displayname' => 'cal',
|
759
|
+
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
|
760
|
+
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
|
761
|
+
'{http://calendarserver.org/ns/}subscribed-strip-todos' => true,
|
762
|
+
# '{http://calendarserver.org/ns/}subscribed-strip-alarms' => true,
|
763
|
+
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => true
|
764
|
+
}
|
765
|
+
|
766
|
+
@backend.create_subscription('principals/user1', 'sub1', props)
|
767
|
+
|
768
|
+
new_props = {
|
769
|
+
'{DAV:}displayname' => 'new displayname',
|
770
|
+
'{http://calendarserver.org/ns/}source' => Dav::Xml::Property::Href.new('http://example.org/cal2.ics', false)
|
771
|
+
}
|
772
|
+
|
773
|
+
@backend.delete_subscription(1)
|
774
|
+
|
775
|
+
subs = @backend.subscriptions_for_user('principals/user1')
|
776
|
+
assert_equal(0, subs.size)
|
777
|
+
end
|
778
|
+
|
779
|
+
def test_scheduling_methods
|
780
|
+
cal_data = "BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n"
|
781
|
+
|
782
|
+
@backend.create_scheduling_object(
|
783
|
+
'principals/user1',
|
784
|
+
'schedule1.ics',
|
785
|
+
cal_data
|
786
|
+
)
|
787
|
+
|
788
|
+
expected = {
|
789
|
+
'calendardata' => cal_data,
|
790
|
+
'uri' => 'schedule1.ics',
|
791
|
+
'etag' => "\"#{Digest::MD5.hexdigest(cal_data)}\"",
|
792
|
+
'size' => cal_data.bytesize
|
793
|
+
}
|
794
|
+
|
795
|
+
result = @backend.scheduling_object('principals/user1', 'schedule1.ics')
|
796
|
+
expected.each do |k, v|
|
797
|
+
assert_has_key(k, result)
|
798
|
+
assert_equal(v, result[k])
|
799
|
+
end
|
800
|
+
|
801
|
+
results = @backend.scheduling_objects('principals/user1')
|
802
|
+
|
803
|
+
assert_equal(1, results.size)
|
804
|
+
result = results[0]
|
805
|
+
expected.each do |k, v|
|
806
|
+
assert_equal(v, result[k])
|
807
|
+
end
|
808
|
+
|
809
|
+
@backend.delete_scheduling_object('principals/user1', 'schedule1.ics')
|
810
|
+
result = @backend.scheduling_object('principals/user1', 'schedule1.ics')
|
811
|
+
|
812
|
+
assert_nil(result)
|
813
|
+
end
|
814
|
+
end
|
815
|
+
end
|
816
|
+
end
|
817
|
+
end
|