# =================================================================================================== # _ __ _ _ # | |/ /__ _| | |_ _ _ _ _ __ _ # | ' . # # @ignore # =================================================================================================== require 'test_helper' require 'open-uri' class DataServiceTest < Test::Unit::TestCase # this test creates a data entry and calls serve action to get a file url. should "get the file url with data content" do data_entry = Kaltura::KalturaDataEntry.new data_entry.name = "kaltura_test" data_entry.data_content = @content created_entry = @client.data_service.add(data_entry) assert_not_nil created_entry.id file_url = @client.data_service.serve(created_entry.id) assert_equal @content, open(file_url).read assert_nil @client.data_service.delete(created_entry.id) end # this test creates a data entry, calls serve action to get file url and test file content. should "get the file url with data content when the forceProxy is 0" do data_entry = Kaltura::KalturaDataEntry.new data_entry.name = "kaltura_test" data_entry.data_content = @content created_entry = @client.data_service.add(data_entry) assert_not_nil created_entry.id file_url = @client.data_service.serve(created_entry.id, nil, false) assert_equal @content, open(file_url).read assert_nil @client.data_service.delete(created_entry.id) end def setup super @content = <<-TXT Test data content. TXT end end