=begin #Web API Swagger specification #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.0-SNAPSHOT =end require 'spec_helper' require 'json' # Unit tests for AsposeCellsCloud::CellsWorkbookApi # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'CellsWorkbookApi' do before do # run before each test if $access_token == nil then conf = AsposeCellsCloud::Configuration.new conf.base_path = "" instance = AsposeCellsCloud::OAuthApi.new(AsposeCellsCloud::ApiClient.new(conf)) $access_token = instance.o_auth_post($grant_type,$client_id,$client_secret).access_token end conf = AsposeCellsCloud::Configuration.new conf.access_token = $access_token client = AsposeCellsCloud::ApiClient.new(conf) client.default_headers["Authorization"] ="Bearer " + $access_token @instance = AsposeCellsCloud::CellsWorkbookApi.new(client) end after do # run after each test end describe 'test an instance of CellsWorkbookApi' do it 'should create an instance of CellsWorkbookApi' do expect(@instance).to be_instance_of(AsposeCellsCloud::CellsWorkbookApi) end end # unit tests for cells_workbook_get_workbook # Read workbook info or export. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [String] :password The document password. # @option opts [String] :format The exported file format. # @option opts [BOOLEAN] :is_auto_fit Set document rows to be autofit. # @option opts [BOOLEAN] :only_save_table Only save table data. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @option opts [String] :out_path The document output folder. # @return [File] describe 'cells_workbook_get_workbook test' do it "should work" do name = $BOOK1 password = nil format = 'XPS' is_auto_fit = true only_save_table = true folder = $TEMPFOLDER out_path = nil @instance.cells_workbook_get_workbook(name, { :password=>password, :format=>format,:folder=>folder, :out_path=>out_path}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_default_style # Read workbook default style info. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The document's folder. # @option opts [String] :storage storage name. # @return [StyleResponse] describe 'cells_workbook_get_workbook_default_style test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_default_style(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_name # Read workbook's name. # # @param name The workbook name. # @param name_name The name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [NameResponse] describe 'cells_workbook_get_workbook_name test' do it "should work" do name = $BOOK1 name_name = 'Name_2' folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_name(name, name_name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_name_value # Get workbook's name value. # # @param name The workbook name. # @param name_name The name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [RangeValueResponse] describe 'cells_workbook_get_workbook_name_value test' do it "should work" do name = $BOOK1 name_name = 'Name_2' folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_name_value(name, name_name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_names # Read workbook's names. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [NamesResponse] describe 'cells_workbook_get_workbook_names test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_names(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_settings # Get Workbook Settings DTO # # @param name Document name. # @param [Hash] opts the optional parameters # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [WorkbookSettingsResponse] describe 'cells_workbook_get_workbook_settings test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_settings(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_get_workbook_text_items # Read workbook's text items. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [TextItemsResponse] describe 'cells_workbook_get_workbook_text_items test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_get_workbook_text_items(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_autofit_workbook_rows # Autofit workbook rows. # # @param name Document name. # @param [Hash] opts the optional parameters # @option opts [AutoFitterOptions] :auto_fitter_options Auto Fitter Options. # @option opts [Integer] :start_row Start row. # @option opts [Integer] :end_row End row. # @option opts [BOOLEAN] :only_auto Only auto. # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_autofit_workbook_rows test' do it "should work" do name = $BOOK1 auto_fitter_options = nil start_row = 1 end_row = 100 only_auto = true folder = $TEMPFOLDER @instance.cells_workbook_post_autofit_workbook_rows(name, {:auto_fitter_options=>auto_fitter_options, :start_row=>start_row, :end_row=>end_row, :only_auto=>only_auto, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_import_data # # # @param name # @param importdata # @param [Hash] opts the optional parameters # @option opts [String] :folder # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_import_data test' do it "should work" do name = $BOOK1 importdata = AsposeCellsCloud::ImportIntArrayOption.new({:DestinationWorksheet=>$SHEET1,:FirstColumn=>1,:FirstRow=>3,:ImportDataType=>'IntArray',:IsVertical=>true,:Data=>[1,2,3,4]}) folder = $TEMPFOLDER @instance.cells_workbook_post_import_data(name, importdata, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbook_calculate_formula # Calculate all formulas in workbook. # # @param name Document name. # @param [Hash] opts the optional parameters # @option opts [CalculationOptions] :options Calculation Options. # @option opts [BOOLEAN] :ignore_error ignore Error. # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_workbook_calculate_formula test' do it "should work" do name = $BOOK1 options = AsposeCellsCloud::CalculationOptions.new({:IgnoreError=>true}) ignore_error = true folder = $TEMPFOLDER @instance.cells_workbook_post_workbook_calculate_formula(name, { :options=>options, :ignore_error=>ignore_error,:folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbook_get_smart_marker_result # Smart marker processing result. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :xml_file The xml file full path, if empty the data is read from request body. # @option opts [String] :folder The workbook folder full path. # @option opts [String] :storage storage name. # @option opts [String] :out_path Path to save result # @return [File] describe 'cells_workbook_post_workbook_get_smart_marker_result test' do it "should work" do name = $BOOK1 xml_file = 'ReportData.xml' folder = $TEMPFOLDER out_path = nil @instance.cells_workbook_post_workbook_get_smart_marker_result(name, { :xml_file=>xml_file,:folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbook_settings # Update Workbook setting # # @param name Document name. # @param [Hash] opts the optional parameters # @option opts [WorkbookSettings] :settings Workbook Setting DTO # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_workbook_settings test' do it "should work" do name = $BOOK1 settings = AsposeCellsCloud::WorkbookSettings.new(:AutoCompressPictures=>true) folder = $TEMPFOLDER @instance.cells_workbook_post_workbook_settings(name, {:settings=>settings, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbook_split # Split workbook. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :format Split format. # @option opts [Integer] :from Start worksheet index. # @option opts [Integer] :to End worksheet index. # @option opts [Integer] :horizontal_resolution Image horizontal resolution. # @option opts [Integer] :vertical_resolution Image vertical resolution. # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [SplitResultResponse] describe 'cells_workbook_post_workbook_split test' do it "should work" do name = $BOOK1 format = 'png' from = 1 to = 3 horizontal_resolution = 100 vertical_resolution = 90 folder = $TEMPFOLDER @instance.cells_workbook_post_workbook_split(name, { :format=>format, :from=>from, :to=>to, :horizontal_resolution=>horizontal_resolution, :vertical_resolution=>vertical_resolution,:folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbooks_merge # Merge workbooks. # # @param name Workbook name. # @param merge_with The workbook to merge with. # @param [Hash] opts the optional parameters # @option opts [String] :folder Source workbook folder. # @option opts [String] :storage storage name. # @return [WorkbookResponse] describe 'cells_workbook_post_workbooks_merge test' do it "should work" do name = $BOOK1 merge_with = 'myDocument.xlsx' folder = $TEMPFOLDER @instance.cells_workbook_post_workbooks_merge(name, merge_with, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbooks_text_replace # Replace text. # # @param name Document name. # @param old_value The old value. # @param new_value The new value. # @param [Hash] opts the optional parameters # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [WorkbookReplaceResponse] describe 'cells_workbook_post_workbooks_text_replace test' do it "should work" do name = $BOOK1 old_value = '!22' new_value = '22' folder = $TEMPFOLDER @instance.cells_workbook_post_workbooks_text_replace(name, old_value, new_value, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_workbooks_text_search # Search text. # # @param name Document name. # @param text Text sample. # @param [Hash] opts the optional parameters # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [TextItemsResponse] describe 'cells_workbook_post_workbooks_text_search test' do it "should work" do name = $BOOK1 text = 'test' folder = $TEMPFOLDER @instance.cells_workbook_post_workbooks_text_search(name, text, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_put_convert_workbook # Convert workbook from request content to some format. # # @param [Hash] opts the optional parameters # @option opts [String] :format The format to convert. # @option opts [String] :password The workbook password. # @option opts [String] :out_path Path to save result # @return [File] describe 'cells_workbook_put_convert_workbook test' do it "should work" do format = 'pdf' password = nil out_path = nil aFile = File.new('/home/roywang/asposecellscloudsdk/data/Book1.xlsx', 'r') book = aFile.sysread(aFile.size) aFile.close @instance.cells_workbook_put_convert_workbook(book,{:format=>format}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_put_workbook_create # Create new workbook using deferent methods. # # @param name The new document name. # @param [Hash] opts the optional parameters # @option opts [String] :template_file The template file, if the data not provided default workbook is created. # @option opts [String] :data_file Smart marker data file, if the data not provided the request content is checked for the data. # @option opts [String] :folder The new document folder. # @option opts [String] :storage storage name. # @return [WorkbookResponse] describe 'cells_workbook_put_workbook_create test' do it "should work" do t = Time.now name = 'NewBook'+ $BOOK1 template_file = $BOOK1 data_file = 'ReportData.xml' folder = $TEMPFOLDER @instance.cells_workbook_put_workbook_create(name, {:template_file=>template_file, :data_file=>data_file, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_delete_workbook_name # Clean workbook's names. # # @param name The workbook name. # @param name_name The name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_delete_workbook_name test' do it "should work" do name = $BOOK1 name_name = 'Name_2' folder = $TEMPFOLDER @instance.cells_workbook_delete_workbook_name(name, name_name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_delete_workbook_names # Clean workbook's names. # # @param name The workbook name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_delete_workbook_names test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_delete_workbook_names(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_put_document_protect_from_changes # Protect document from changes. # # @param name Document name. # @param [Hash] opts the optional parameters # @option opts [PasswordRequest] :password Modification password. # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_put_document_protect_from_changes test' do it "should work" do name = $BOOK1 password = AsposeCellsCloud::PasswordRequest.new({:Password=>'123456'}) folder = $TEMPFOLDER @instance.cells_workbook_put_document_protect_from_changes(name, {:password=>password, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_protect_document # Protect document. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [WorkbookProtectionRequest] :protection The protection settings. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_protect_document test' do it "should work" do name = $BOOK1 protection = AsposeCellsCloud::WorkbookProtectionRequest.new(:Password=>'123',:ProtectionType=>'All') folder = $TEMPFOLDER @instance.cells_workbook_post_protect_document(name, { :protection=>protection, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_delete_unprotect_document # Unprotect document. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [WorkbookProtectionRequest] :protection Protection settings, only password can be specified. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_delete_unprotect_document test' do it "should work" do name = $BOOK1 protection = AsposeCellsCloud::WorkbookProtectionRequest.new({:Password=>'123',:ProtectionType=>'All'}) folder = $TEMPFOLDER @instance.cells_workbook_delete_unprotect_document(name, {:protection=>protection, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_delete_document_unprotect_from_changes # Unprotect document from changes. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_delete_document_unprotect_from_changes test' do it "should work" do name = $BOOK1 folder = $TEMPFOLDER @instance.cells_workbook_delete_document_unprotect_from_changes(name, { :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_post_encrypt_document # Encript document. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [WorkbookEncryptionRequest] :encryption Encryption parameters. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_post_encrypt_document test' do it "should work" do name = $BOOK1 encryption = AsposeCellsCloud::WorkbookEncryptionRequest.new({:Password=>'123456',:KeyLength=>128,:EncryptionType=>'XOR'}) folder = $TEMPFOLDER @instance.cells_workbook_post_encrypt_document(name, {:encryption=>encryption, :folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_workbook_delete_decrypt_document # Decrypt document. # # @param name The document name. # @param [Hash] opts the optional parameters # @option opts [WorkbookEncryptionRequest] :encryption Encryption settings, only password can be specified. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [SaaSposeResponse] describe 'cells_workbook_delete_decrypt_document test' do it "should work" do name = $BOOK1 encryption = AsposeCellsCloud::WorkbookEncryptionRequest.new({:Password=>'123456',:KeyLength=>128,:EncryptionType=>'XOR'}) folder = $TEMPFOLDER @instance.cells_workbook_delete_decrypt_document(name, { :encryption=>encryption,:folder=>folder}) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end