require 'spec_helper' require 'json' # Unit tests for AsposeCellsCloud::CellsPicturesApi # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate describe 'CellsPicturesApi' do before do @instance = AsposeCellsCloud::CellsApi.new($client_id,$client_secret,"v3.0") end after do # run after each test end # unit tests for cells_pictures_get_worksheet_picture # GRead worksheet picture by number. # # @param name Document name. # @param sheet_name Worksheet name. # @param picture_index The picture index. # @param [Hash] opts the optional parameters # @option opts [String] :format The exported object format. # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [File] describe 'cells_pictures_get_worksheet_picture test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 picture_index = 0 format = 'PNG' folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_get_worksheet_picture(name, sheet_name, picture_index, {:format=>format, :folder=>folder}) # expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_pictures_get_worksheet_pictures # Read worksheet pictures. # # @param name Document name. # @param sheet_name The worksheet name. # @param [Hash] opts the optional parameters # @option opts [String] :folder Document's folder. # @option opts [String] :storage storage name. # @return [PicturesResponse] describe 'cells_pictures_get_worksheet_pictures test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_get_worksheet_pictures(name, sheet_name, { :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_pictures_post_worksheet_picture # Update worksheet picture by index. # # @param name Document name. # @param sheet_name Worksheet name. # @param picture_index The picture's index. # @param [Hash] opts the optional parameters # @option opts [Picture] :picture Picture object # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [PictureResponse] describe 'cells_pictures_post_worksheet_picture test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 picture_index = 0 picture = AsposeCellsCloud::Picture.new(:AlternativeText=>'AlternativeText') folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_post_worksheet_picture(name, sheet_name, picture_index, {:picture=>picture, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_pictures_put_worksheet_add_picture # Add a new worksheet picture. # # @param name The workbook name. # @param sheet_name The worsheet name. # @param [Hash] opts the optional parameters # @option opts [Picture] :picture Pictute object # @option opts [Integer] :upper_left_row The image upper left row. # @option opts [Integer] :upper_left_column The image upper left column. # @option opts [Integer] :lower_right_row The image low right row. # @option opts [Integer] :lower_right_column The image low right column. # @option opts [String] :picture_path The picture path, if not provided the picture data is inspected in the request body. # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [PicturesResponse] describe 'cells_pictures_put_worksheet_add_picture test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 picture = nil upper_left_row = 1 upper_left_column = 1 lower_right_row = 10 lower_right_column = 10 picture_path = 'WaterMark.png' folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_put_worksheet_add_picture(name, sheet_name, {:picture=>picture, :upper_left_row=>upper_left_row, :upper_left_column=>upper_left_column, :lower_right_row=>lower_right_row, :lower_right_column=>lower_right_column, :picture_path=>picture_path, :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_pictures_delete_worksheet_picture # Delete a picture object in worksheet # # @param name The workbook name. # @param sheet_name The worsheet name. # @param picture_index Picture index # @param [Hash] opts the optional parameters # @option opts [String] :folder The workbook folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_pictures_delete_worksheet_picture test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 picture_index = 0 folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_delete_worksheet_picture(name, sheet_name, picture_index, { :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end # unit tests for cells_pictures_delete_worksheet_pictures # Delete all pictures in worksheet. # # @param name Document name. # @param sheet_name Worksheet name. # @param [Hash] opts the optional parameters # @option opts [String] :folder The document folder. # @option opts [String] :storage storage name. # @return [CellsCloudResponse] describe 'cells_pictures_delete_worksheet_pictures test' do it "should work" do name = $BOOK1 sheet_name = $SHEET6 folder = $TEMPFOLDER result = @instance.upload_file( folder+"/"+name, ::File.open(File.expand_path("data/"+name),"r") {|io| io.read(io.size) }) expect(result.uploaded.size).to be > 0 result = @instance.cells_pictures_delete_worksheet_pictures(name, sheet_name, { :folder=>folder}) expect(result.code).to eql(200) # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers end end end