# =================================================================================================== # _ __ _ _ # | |/ /__ _| | |_ _ _ _ _ __ _ # | ' . # # @ignore # =================================================================================================== require 'test_helper' class MetadataProfileServiceTest < Test::Unit::TestCase # this test adds a metadata_profile and retrieves the list of metadata_profiles to demonstrate the use of kaltura plugins. should "creates a metadata_profile and get the metadata_profile list" do # cleaning up the list metadata_profile_filter = Kaltura::KalturaMetadataProfileFilter.new filter_pager = Kaltura::KalturaFilterPager.new metadata_profile_list = @client.metadata_profile_service.list(metadata_profile_filter, filter_pager) metadata_profile_list.objects.each do |obj| @client.metadata_profile_service.delete(obj.id) rescue nil end if metadata_profile_list.objects # creates a metadata_profile metadata_profile = Kaltura::KalturaMetadataProfile.new metadata_profile.name = "test profile" metadata_profile.metadata_object_type = Kaltura::KalturaMetadataObjectType::ENTRY metadata_profile.create_mode = Kaltura::KalturaMetadataProfileCreateMode::API created_metadata_profile = @client.metadata_profile_service.add(metadata_profile, "", "viewsData") assert_not_nil created_metadata_profile.id # list the metadata_profiles metadata_profile_filter = Kaltura::KalturaMetadataProfileFilter.new filter_pager = Kaltura::KalturaFilterPager.new metadata_profile_list = @client.metadata_profile_service.list(metadata_profile_filter, filter_pager) assert_equal metadata_profile_list.total_count, 1 assert_nil @client.metadata_profile_service.delete(created_metadata_profile.id) end end