aspose_slides_cloud 22.5.0 → 22.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +13 -0
- data/Gemfile +7 -7
- data/Gemfile.lock +73 -0
- data/LICENSE +20 -20
- data/README.md +120 -112
- data/Rakefile +8 -8
- data/TestData/TemplatingCVDataWithBase64.xml +22 -22
- data/aspose_slides_cloud.gemspec +56 -56
- data/docker-entrypoint.sh +7 -0
- data/lib/aspose_slides_cloud/api/slides_api.rb +19879 -19455
- data/lib/aspose_slides_cloud/api_client.rb +450 -450
- data/lib/aspose_slides_cloud/api_error.rb +48 -48
- data/lib/aspose_slides_cloud/configuration.rb +188 -188
- data/lib/aspose_slides_cloud/models/accent_element.rb +243 -243
- data/lib/aspose_slides_cloud/models/access_permissions.rb +321 -321
- data/lib/aspose_slides_cloud/models/add_layout_slide.rb +248 -248
- data/lib/aspose_slides_cloud/models/add_master_slide.rb +263 -263
- data/lib/aspose_slides_cloud/models/add_shape.rb +243 -243
- data/lib/aspose_slides_cloud/models/add_slide.rb +273 -273
- data/lib/aspose_slides_cloud/models/alpha_bi_level_effect.rb +238 -238
- data/lib/aspose_slides_cloud/models/alpha_ceiling_effect.rb +223 -223
- data/lib/aspose_slides_cloud/models/alpha_floor_effect.rb +223 -223
- data/lib/aspose_slides_cloud/models/alpha_inverse_effect.rb +223 -223
- data/lib/aspose_slides_cloud/models/alpha_modulate_effect.rb +223 -223
- data/lib/aspose_slides_cloud/models/alpha_modulate_fixed_effect.rb +238 -238
- data/lib/aspose_slides_cloud/models/alpha_replace_effect.rb +238 -238
- data/lib/aspose_slides_cloud/models/api_info.rb +221 -221
- data/lib/aspose_slides_cloud/models/arc_to_path_segment.rb +283 -283
- data/lib/aspose_slides_cloud/models/array_element.rb +309 -309
- data/lib/aspose_slides_cloud/models/arrow_head_properties.rb +289 -289
- data/lib/aspose_slides_cloud/models/audio_frame.rb +395 -395
- data/lib/aspose_slides_cloud/models/axes.rb +241 -241
- data/lib/aspose_slides_cloud/models/axis.rb +723 -723
- data/lib/aspose_slides_cloud/models/bar_element.rb +255 -255
- data/lib/aspose_slides_cloud/models/base64_input_file.rb +234 -234
- data/lib/aspose_slides_cloud/models/bi_level_effect.rb +238 -238
- data/lib/aspose_slides_cloud/models/block_element.rb +235 -235
- data/lib/aspose_slides_cloud/models/blur_effect.rb +231 -231
- data/lib/aspose_slides_cloud/models/blur_image_effect.rb +253 -253
- data/lib/aspose_slides_cloud/models/border_box_element.rb +313 -313
- data/lib/aspose_slides_cloud/models/box_element.rb +283 -283
- data/lib/aspose_slides_cloud/models/bubble_chart_data_point.rb +216 -216
- data/lib/aspose_slides_cloud/models/bubble_series.rb +260 -260
- data/lib/aspose_slides_cloud/models/camera.rb +295 -295
- data/lib/aspose_slides_cloud/models/chart.rb +393 -371
- data/lib/aspose_slides_cloud/models/chart_category.rb +275 -275
- data/lib/aspose_slides_cloud/models/chart_lines_format.rb +221 -221
- data/lib/aspose_slides_cloud/models/chart_series_group.rb +399 -0
- data/lib/aspose_slides_cloud/models/chart_title.rb +226 -226
- data/lib/aspose_slides_cloud/models/chart_wall.rb +285 -285
- data/lib/aspose_slides_cloud/models/close_path_segment.rb +223 -223
- data/lib/aspose_slides_cloud/models/color_change_effect.rb +243 -243
- data/lib/aspose_slides_cloud/models/color_replace_effect.rb +233 -233
- data/lib/aspose_slides_cloud/models/color_scheme.rb +321 -321
- data/lib/aspose_slides_cloud/models/common_slide_view_properties.rb +221 -221
- data/lib/aspose_slides_cloud/models/connector.rb +281 -281
- data/lib/aspose_slides_cloud/models/cubic_bezier_to_path_segment.rb +313 -313
- data/lib/aspose_slides_cloud/models/custom_dash_pattern.rb +213 -213
- data/lib/aspose_slides_cloud/models/data_point.rb +201 -201
- data/lib/aspose_slides_cloud/models/delimiter_element.rb +297 -297
- data/lib/aspose_slides_cloud/models/disc_usage.rb +231 -231
- data/lib/aspose_slides_cloud/models/document.rb +261 -261
- data/lib/aspose_slides_cloud/models/document_properties.rb +213 -213
- data/lib/aspose_slides_cloud/models/document_property.rb +236 -236
- data/lib/aspose_slides_cloud/models/document_replace_result.rb +222 -222
- data/lib/aspose_slides_cloud/models/duotone_effect.rb +243 -243
- data/lib/aspose_slides_cloud/models/effect.rb +438 -438
- data/lib/aspose_slides_cloud/models/effect_format.rb +281 -281
- data/lib/aspose_slides_cloud/models/entity_exists.rb +216 -216
- data/lib/aspose_slides_cloud/models/error.rb +241 -241
- data/lib/aspose_slides_cloud/models/error_details.rb +226 -226
- data/lib/aspose_slides_cloud/models/export_format.rb +63 -63
- data/lib/aspose_slides_cloud/models/export_options.rb +232 -232
- data/lib/aspose_slides_cloud/models/file_version.rb +229 -229
- data/lib/aspose_slides_cloud/models/file_versions.rb +213 -213
- data/lib/aspose_slides_cloud/models/files_list.rb +213 -213
- data/lib/aspose_slides_cloud/models/files_upload_result.rb +225 -225
- data/lib/aspose_slides_cloud/models/fill_format.rb +244 -244
- data/lib/aspose_slides_cloud/models/fill_overlay_effect.rb +250 -250
- data/lib/aspose_slides_cloud/models/fill_overlay_image_effect.rb +260 -260
- data/lib/aspose_slides_cloud/models/font_fallback_rule.rb +243 -243
- data/lib/aspose_slides_cloud/models/font_scheme.rb +231 -231
- data/lib/aspose_slides_cloud/models/font_set.rb +231 -231
- data/lib/aspose_slides_cloud/models/format_scheme.rb +249 -249
- data/lib/aspose_slides_cloud/models/fraction_element.rb +265 -265
- data/lib/aspose_slides_cloud/models/function_element.rb +243 -243
- data/lib/aspose_slides_cloud/models/geometry_path.rb +267 -267
- data/lib/aspose_slides_cloud/models/geometry_paths.rb +213 -213
- data/lib/aspose_slides_cloud/models/geometry_shape.rb +266 -266
- data/lib/aspose_slides_cloud/models/gif_export_options.rb +235 -235
- data/lib/aspose_slides_cloud/models/glow_effect.rb +226 -226
- data/lib/aspose_slides_cloud/models/gradient_fill.rb +346 -346
- data/lib/aspose_slides_cloud/models/gradient_fill_stop.rb +226 -226
- data/lib/aspose_slides_cloud/models/graphical_object.rb +240 -240
- data/lib/aspose_slides_cloud/models/gray_scale_effect.rb +223 -223
- data/lib/aspose_slides_cloud/models/group_shape.rb +250 -250
- data/lib/aspose_slides_cloud/models/grouping_character_element.rb +287 -287
- data/lib/aspose_slides_cloud/models/header_footer.rb +251 -251
- data/lib/aspose_slides_cloud/models/hsl_effect.rb +268 -268
- data/lib/aspose_slides_cloud/models/html5_export_options.rb +223 -223
- data/lib/aspose_slides_cloud/models/html_export_options.rb +381 -381
- data/lib/aspose_slides_cloud/models/hyperlink.rb +352 -352
- data/lib/aspose_slides_cloud/models/i_shape_export_options.rb +201 -201
- data/lib/aspose_slides_cloud/models/image.rb +241 -241
- data/lib/aspose_slides_cloud/models/image_export_format.rb +43 -43
- data/lib/aspose_slides_cloud/models/image_export_options.rb +291 -291
- data/lib/aspose_slides_cloud/models/image_export_options_base.rb +222 -222
- data/lib/aspose_slides_cloud/models/image_transform_effect.rb +244 -244
- data/lib/aspose_slides_cloud/models/images.rb +213 -213
- data/lib/aspose_slides_cloud/models/inner_shadow_effect.rb +256 -256
- data/lib/aspose_slides_cloud/models/input.rb +231 -231
- data/lib/aspose_slides_cloud/models/input_file.rb +254 -254
- data/lib/aspose_slides_cloud/models/interactive_sequence.rb +228 -228
- data/lib/aspose_slides_cloud/models/layout_slide.rb +282 -282
- data/lib/aspose_slides_cloud/models/layout_slides.rb +213 -213
- data/lib/aspose_slides_cloud/models/left_sub_superscript_element.rb +253 -253
- data/lib/aspose_slides_cloud/models/legend.rb +335 -335
- data/lib/aspose_slides_cloud/models/light_rig.rb +297 -297
- data/lib/aspose_slides_cloud/models/limit_element.rb +253 -253
- data/lib/aspose_slides_cloud/models/line_format.rb +415 -415
- data/lib/aspose_slides_cloud/models/line_to_path_segment.rb +253 -253
- data/lib/aspose_slides_cloud/models/luminance_effect.rb +253 -253
- data/lib/aspose_slides_cloud/models/master_slide.rb +235 -235
- data/lib/aspose_slides_cloud/models/master_slides.rb +213 -213
- data/lib/aspose_slides_cloud/models/math_element.rb +244 -244
- data/lib/aspose_slides_cloud/models/math_paragraph.rb +257 -257
- data/lib/aspose_slides_cloud/models/matrix_element.rb +341 -341
- data/lib/aspose_slides_cloud/models/merge.rb +235 -235
- data/lib/aspose_slides_cloud/models/merging_source.rb +223 -223
- data/lib/aspose_slides_cloud/models/move_to_path_segment.rb +253 -253
- data/lib/aspose_slides_cloud/models/nary_operator_element.rb +315 -315
- data/lib/aspose_slides_cloud/models/no_fill.rb +223 -223
- data/lib/aspose_slides_cloud/models/normal_view_restored_properties.rb +221 -221
- data/lib/aspose_slides_cloud/models/notes_slide.rb +221 -221
- data/lib/aspose_slides_cloud/models/notes_slide_export_format.rb +43 -43
- data/lib/aspose_slides_cloud/models/notes_slide_header_footer.rb +271 -271
- data/lib/aspose_slides_cloud/models/object_exist.rb +231 -231
- data/lib/aspose_slides_cloud/models/ole_object_frame.rb +335 -335
- data/lib/aspose_slides_cloud/models/one_value_chart_data_point.rb +234 -224
- data/lib/aspose_slides_cloud/models/one_value_series.rb +330 -330
- data/lib/aspose_slides_cloud/models/ordered_merge_request.rb +213 -213
- data/lib/aspose_slides_cloud/models/outer_shadow_effect.rb +256 -256
- data/lib/aspose_slides_cloud/models/output_file.rb +244 -244
- data/lib/aspose_slides_cloud/models/paragraph.rb +531 -531
- data/lib/aspose_slides_cloud/models/paragraphs.rb +213 -213
- data/lib/aspose_slides_cloud/models/path_input_file.rb +244 -244
- data/lib/aspose_slides_cloud/models/path_output_file.rb +243 -243
- data/lib/aspose_slides_cloud/models/path_segment.rb +244 -244
- data/lib/aspose_slides_cloud/models/pattern_fill.rb +270 -270
- data/lib/aspose_slides_cloud/models/pdf_export_options.rb +465 -465
- data/lib/aspose_slides_cloud/models/picture_fill.rb +367 -367
- data/lib/aspose_slides_cloud/models/picture_frame.rb +251 -251
- data/lib/aspose_slides_cloud/models/pipeline.rb +223 -223
- data/lib/aspose_slides_cloud/models/placeholder.rb +329 -329
- data/lib/aspose_slides_cloud/models/placeholders.rb +213 -213
- data/lib/aspose_slides_cloud/models/plot_area.rb +315 -315
- data/lib/aspose_slides_cloud/models/portion.rb +653 -653
- data/lib/aspose_slides_cloud/models/portion_format.rb +633 -633
- data/lib/aspose_slides_cloud/models/portions.rb +213 -213
- data/lib/aspose_slides_cloud/models/pptx_export_options.rb +247 -247
- data/lib/aspose_slides_cloud/models/presentation_to_merge.rb +277 -277
- data/lib/aspose_slides_cloud/models/presentations_merge_request.rb +225 -225
- data/lib/aspose_slides_cloud/models/preset_shadow_effect.rb +290 -290
- data/lib/aspose_slides_cloud/models/protection_properties.rb +271 -271
- data/lib/aspose_slides_cloud/models/quadratic_bezier_to_path_segment.rb +283 -283
- data/lib/aspose_slides_cloud/models/radical_element.rb +253 -253
- data/lib/aspose_slides_cloud/models/reflection_effect.rb +445 -445
- data/lib/aspose_slides_cloud/models/remove_shape.rb +233 -233
- data/lib/aspose_slides_cloud/models/remove_slide.rb +238 -238
- data/lib/aspose_slides_cloud/models/reorder_slide.rb +253 -253
- data/lib/aspose_slides_cloud/models/replace_text.rb +273 -273
- data/lib/aspose_slides_cloud/models/request_input_file.rb +239 -239
- data/lib/aspose_slides_cloud/models/reset_slide.rb +238 -238
- data/lib/aspose_slides_cloud/models/resource_base.rb +223 -223
- data/lib/aspose_slides_cloud/models/resource_uri.rb +261 -261
- data/lib/aspose_slides_cloud/models/response_output_file.rb +223 -223
- data/lib/aspose_slides_cloud/models/right_sub_superscript_element.rb +263 -263
- data/lib/aspose_slides_cloud/models/save.rb +270 -270
- data/lib/aspose_slides_cloud/models/save_shape.rb +280 -280
- data/lib/aspose_slides_cloud/models/save_slide.rb +305 -305
- data/lib/aspose_slides_cloud/models/scatter_chart_data_point.rb +229 -229
- data/lib/aspose_slides_cloud/models/scatter_series.rb +250 -250
- data/lib/aspose_slides_cloud/models/section.rb +238 -238
- data/lib/aspose_slides_cloud/models/section_zoom_frame.rb +255 -255
- data/lib/aspose_slides_cloud/models/sections.rb +213 -213
- data/lib/aspose_slides_cloud/models/series.rb +386 -386
- data/lib/aspose_slides_cloud/models/series_marker.rb +285 -285
- data/lib/aspose_slides_cloud/models/shape.rb +271 -271
- data/lib/aspose_slides_cloud/models/shape_base.rb +399 -399
- data/lib/aspose_slides_cloud/models/shape_bevel.rb +265 -265
- data/lib/aspose_slides_cloud/models/shape_export_format.rb +44 -44
- data/lib/aspose_slides_cloud/models/shape_image_export_options.rb +275 -275
- data/lib/aspose_slides_cloud/models/shape_thumbnail_bounds.rb +41 -41
- data/lib/aspose_slides_cloud/models/shape_type.rb +54 -54
- data/lib/aspose_slides_cloud/models/shapes.rb +213 -213
- data/lib/aspose_slides_cloud/models/shapes_alignment_type.rb +46 -46
- data/lib/aspose_slides_cloud/models/slide.rb +326 -326
- data/lib/aspose_slides_cloud/models/slide_animation.rb +225 -225
- data/lib/aspose_slides_cloud/models/slide_background.rb +270 -270
- data/lib/aspose_slides_cloud/models/slide_comment.rb +227 -227
- data/lib/aspose_slides_cloud/models/slide_comment_base.rb +286 -286
- data/lib/aspose_slides_cloud/models/slide_comments.rb +213 -213
- data/lib/aspose_slides_cloud/models/slide_export_format.rb +60 -60
- data/lib/aspose_slides_cloud/models/slide_modern_comment.rb +269 -269
- data/lib/aspose_slides_cloud/models/slide_properties.rb +319 -319
- data/lib/aspose_slides_cloud/models/slide_replace_result.rb +227 -227
- data/lib/aspose_slides_cloud/models/slides.rb +213 -213
- data/lib/aspose_slides_cloud/models/smart_art.rb +348 -348
- data/lib/aspose_slides_cloud/models/smart_art_node.rb +307 -307
- data/lib/aspose_slides_cloud/models/smart_art_shape.rb +241 -241
- data/lib/aspose_slides_cloud/models/soft_edge_effect.rb +216 -216
- data/lib/aspose_slides_cloud/models/solid_fill.rb +233 -233
- data/lib/aspose_slides_cloud/models/special_slide_type.rb +41 -41
- data/lib/aspose_slides_cloud/models/split_document_result.rb +213 -213
- data/lib/aspose_slides_cloud/models/storage_exist.rb +216 -216
- data/lib/aspose_slides_cloud/models/storage_file.rb +261 -261
- data/lib/aspose_slides_cloud/models/subscript_element.rb +243 -243
- data/lib/aspose_slides_cloud/models/summary_zoom_frame.rb +274 -274
- data/lib/aspose_slides_cloud/models/summary_zoom_section.rb +266 -266
- data/lib/aspose_slides_cloud/models/superscript_element.rb +243 -243
- data/lib/aspose_slides_cloud/models/svg_export_options.rb +339 -339
- data/lib/aspose_slides_cloud/models/swf_export_options.rb +449 -449
- data/lib/aspose_slides_cloud/models/table.rb +356 -356
- data/lib/aspose_slides_cloud/models/table_cell.rb +427 -427
- data/lib/aspose_slides_cloud/models/table_column.rb +216 -216
- data/lib/aspose_slides_cloud/models/table_row.rb +243 -243
- data/lib/aspose_slides_cloud/models/task.rb +244 -244
- data/lib/aspose_slides_cloud/models/text_bounds.rb +261 -261
- data/lib/aspose_slides_cloud/models/text_element.rb +233 -233
- data/lib/aspose_slides_cloud/models/text_frame_format.rb +255 -255
- data/lib/aspose_slides_cloud/models/text_item.rb +221 -221
- data/lib/aspose_slides_cloud/models/text_items.rb +213 -213
- data/lib/aspose_slides_cloud/models/theme.rb +241 -241
- data/lib/aspose_slides_cloud/models/three_d_format.rb +335 -335
- data/lib/aspose_slides_cloud/models/tiff_export_options.rb +375 -375
- data/lib/aspose_slides_cloud/models/tint_effect.rb +253 -253
- data/lib/aspose_slides_cloud/models/update_background.rb +245 -245
- data/lib/aspose_slides_cloud/models/update_shape.rb +243 -243
- data/lib/aspose_slides_cloud/models/video_export_options.rb +289 -289
- data/lib/aspose_slides_cloud/models/video_frame.rb +345 -345
- data/lib/aspose_slides_cloud/models/view_properties.rb +361 -361
- data/lib/aspose_slides_cloud/models/xaml_export_options.rb +213 -213
- data/lib/aspose_slides_cloud/models/xps_export_options.rb +233 -233
- data/lib/aspose_slides_cloud/models/xy_series.rb +255 -255
- data/lib/aspose_slides_cloud/models/zoom_frame.rb +255 -255
- data/lib/aspose_slides_cloud/models/zoom_object.rb +301 -301
- data/lib/aspose_slides_cloud/type_registry.rb +462 -461
- data/lib/aspose_slides_cloud/version.rb +25 -25
- data/lib/aspose_slides_cloud.rb +284 -283
- data/spec/api/slides_api_spec.rb +54650 -53418
- data/spec/spec_helper.rb +122 -122
- data/spec/spec_utils.rb +188 -188
- data/spec/use_cases/abstract_class_spec.rb +38 -38
- data/spec/use_cases/animation_spec.rb +193 -193
- data/spec/use_cases/auth_spec.rb +91 -91
- data/spec/use_cases/chart_spec.rb +291 -291
- data/spec/use_cases/convert_spec.rb +154 -154
- data/spec/use_cases/create_spec.rb +101 -101
- data/spec/use_cases/header_footer_spec.rb +78 -78
- data/spec/use_cases/hyperlink_spec.rb +92 -92
- data/spec/use_cases/image_spec.rb +102 -102
- data/spec/use_cases/layout_slide_spec.rb +190 -190
- data/spec/use_cases/master_slide_spec.rb +190 -190
- data/spec/use_cases/math_spec.rb +163 -163
- data/spec/use_cases/merge_spec.rb +105 -105
- data/spec/use_cases/notes_slide_spec.rb +172 -172
- data/spec/use_cases/nullable_field_spec.rb +86 -86
- data/spec/use_cases/pipeline_spec.rb +61 -61
- data/spec/use_cases/property_spec.rb +177 -177
- data/spec/use_cases/section_spec.rb +104 -104
- data/spec/use_cases/shape_format_spec.rb +126 -126
- data/spec/use_cases/shape_spec.rb +397 -397
- data/spec/use_cases/split_spec.rb +88 -88
- data/spec/use_cases/text_spec.rb +74 -74
- data/spec/use_cases/timeout_spec.rb +44 -44
- data/spec/use_cases/watermark_spec.rb +158 -158
- data/testConfig.json +7 -7
- data/testRules.json +530 -527
- metadata +10 -7
- data/.gitignore +0 -1
data/spec/spec_helper.rb
CHANGED
@@ -1,122 +1,122 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright (c) 2019 Aspose Pty Ltd
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
6
|
-
in the Software without restriction, including without limitation the rights
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
9
|
-
furnished to do so, subject to the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be included in all
|
12
|
-
copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
SOFTWARE.
|
21
|
-
=end
|
22
|
-
|
23
|
-
# load the gem
|
24
|
-
require 'aspose_slides_cloud'
|
25
|
-
require 'spec_utils'
|
26
|
-
|
27
|
-
# The following was generated by the `rspec --init` command. Conventionally, all
|
28
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
29
|
-
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
30
|
-
# this file to always be loaded, without a need to explicitly require it in any
|
31
|
-
# files.
|
32
|
-
#
|
33
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
34
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
35
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
36
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
37
|
-
# a separate helper file that requires the additional dependencies and performs
|
38
|
-
# the additional setup, and require it from the spec files that actually need
|
39
|
-
# it.
|
40
|
-
#
|
41
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
42
|
-
# users commonly want.
|
43
|
-
#
|
44
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
45
|
-
RSpec.configure do |config|
|
46
|
-
# rspec-expectations config goes here. You can use an alternate
|
47
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
48
|
-
# assertions if you prefer.
|
49
|
-
config.expect_with :rspec do |expectations|
|
50
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
51
|
-
# and `failure_message` of custom matchers include text for helper methods
|
52
|
-
# defined using `chain`, e.g.:
|
53
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
54
|
-
# # => "be bigger than 2 and smaller than 4"
|
55
|
-
# ...rather than:
|
56
|
-
# # => "be bigger than 2"
|
57
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
58
|
-
end
|
59
|
-
|
60
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
61
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
62
|
-
config.mock_with :rspec do |mocks|
|
63
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
64
|
-
# a real object. This is generally recommended, and will default to
|
65
|
-
# `true` in RSpec 4.
|
66
|
-
mocks.verify_partial_doubles = true
|
67
|
-
end
|
68
|
-
|
69
|
-
# The settings below are suggested to provide a good initial experience
|
70
|
-
# with RSpec, but feel free to customize to your heart's content.
|
71
|
-
=begin
|
72
|
-
# These two settings work together to allow you to limit a spec run
|
73
|
-
# to individual examples or groups you care about by tagging them with
|
74
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
75
|
-
# get run.
|
76
|
-
config.filter_run :focus
|
77
|
-
config.run_all_when_everything_filtered = true
|
78
|
-
|
79
|
-
# Allows RSpec to persist some state between runs in order to support
|
80
|
-
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
81
|
-
# you configure your source control system to ignore this file.
|
82
|
-
config.example_status_persistence_file_path = "spec/examples.txt"
|
83
|
-
|
84
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
85
|
-
# recommended. For more details, see:
|
86
|
-
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
87
|
-
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
88
|
-
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
89
|
-
config.disable_monkey_patching!
|
90
|
-
|
91
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
92
|
-
# be too noisy due to issues in dependencies.
|
93
|
-
config.warnings = true
|
94
|
-
|
95
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
96
|
-
# file, and it's useful to allow more verbose output when running an
|
97
|
-
# individual spec file.
|
98
|
-
if config.files_to_run.one?
|
99
|
-
# Use the documentation formatter for detailed output,
|
100
|
-
# unless a formatter has already been configured
|
101
|
-
# (e.g. via a command-line flag).
|
102
|
-
config.default_formatter = 'doc'
|
103
|
-
end
|
104
|
-
|
105
|
-
# Print the 10 slowest examples and example groups at the
|
106
|
-
# end of the spec run, to help surface which specs are running
|
107
|
-
# particularly slow.
|
108
|
-
config.profile_examples = 10
|
109
|
-
|
110
|
-
# Run specs in random order to surface order dependencies. If you find an
|
111
|
-
# order dependency and want to debug it, you can fix the order by providing
|
112
|
-
# the seed, which is printed after each run.
|
113
|
-
# --seed 1234
|
114
|
-
config.order = :random
|
115
|
-
|
116
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
117
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
118
|
-
# test failures related to randomization by passing the same `--seed` value
|
119
|
-
# as the one that triggered the failure.
|
120
|
-
Kernel.srand config.seed
|
121
|
-
=end
|
122
|
-
end
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2019 Aspose Pty Ltd
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
+
SOFTWARE.
|
21
|
+
=end
|
22
|
+
|
23
|
+
# load the gem
|
24
|
+
require 'aspose_slides_cloud'
|
25
|
+
require 'spec_utils'
|
26
|
+
|
27
|
+
# The following was generated by the `rspec --init` command. Conventionally, all
|
28
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
29
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
30
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
31
|
+
# files.
|
32
|
+
#
|
33
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
34
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
35
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
36
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
37
|
+
# a separate helper file that requires the additional dependencies and performs
|
38
|
+
# the additional setup, and require it from the spec files that actually need
|
39
|
+
# it.
|
40
|
+
#
|
41
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
42
|
+
# users commonly want.
|
43
|
+
#
|
44
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
45
|
+
RSpec.configure do |config|
|
46
|
+
# rspec-expectations config goes here. You can use an alternate
|
47
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
48
|
+
# assertions if you prefer.
|
49
|
+
config.expect_with :rspec do |expectations|
|
50
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
51
|
+
# and `failure_message` of custom matchers include text for helper methods
|
52
|
+
# defined using `chain`, e.g.:
|
53
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
54
|
+
# # => "be bigger than 2 and smaller than 4"
|
55
|
+
# ...rather than:
|
56
|
+
# # => "be bigger than 2"
|
57
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
58
|
+
end
|
59
|
+
|
60
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
61
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
62
|
+
config.mock_with :rspec do |mocks|
|
63
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
64
|
+
# a real object. This is generally recommended, and will default to
|
65
|
+
# `true` in RSpec 4.
|
66
|
+
mocks.verify_partial_doubles = true
|
67
|
+
end
|
68
|
+
|
69
|
+
# The settings below are suggested to provide a good initial experience
|
70
|
+
# with RSpec, but feel free to customize to your heart's content.
|
71
|
+
=begin
|
72
|
+
# These two settings work together to allow you to limit a spec run
|
73
|
+
# to individual examples or groups you care about by tagging them with
|
74
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
75
|
+
# get run.
|
76
|
+
config.filter_run :focus
|
77
|
+
config.run_all_when_everything_filtered = true
|
78
|
+
|
79
|
+
# Allows RSpec to persist some state between runs in order to support
|
80
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
81
|
+
# you configure your source control system to ignore this file.
|
82
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
83
|
+
|
84
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
85
|
+
# recommended. For more details, see:
|
86
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
87
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
88
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
89
|
+
config.disable_monkey_patching!
|
90
|
+
|
91
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
92
|
+
# be too noisy due to issues in dependencies.
|
93
|
+
config.warnings = true
|
94
|
+
|
95
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
96
|
+
# file, and it's useful to allow more verbose output when running an
|
97
|
+
# individual spec file.
|
98
|
+
if config.files_to_run.one?
|
99
|
+
# Use the documentation formatter for detailed output,
|
100
|
+
# unless a formatter has already been configured
|
101
|
+
# (e.g. via a command-line flag).
|
102
|
+
config.default_formatter = 'doc'
|
103
|
+
end
|
104
|
+
|
105
|
+
# Print the 10 slowest examples and example groups at the
|
106
|
+
# end of the spec run, to help surface which specs are running
|
107
|
+
# particularly slow.
|
108
|
+
config.profile_examples = 10
|
109
|
+
|
110
|
+
# Run specs in random order to surface order dependencies. If you find an
|
111
|
+
# order dependency and want to debug it, you can fix the order by providing
|
112
|
+
# the seed, which is printed after each run.
|
113
|
+
# --seed 1234
|
114
|
+
config.order = :random
|
115
|
+
|
116
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
117
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
118
|
+
# test failures related to randomization by passing the same `--seed` value
|
119
|
+
# as the one that triggered the failure.
|
120
|
+
Kernel.srand config.seed
|
121
|
+
=end
|
122
|
+
end
|
data/spec/spec_utils.rb
CHANGED
@@ -1,188 +1,188 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright (c) 2019 Aspose Pty Ltd
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
6
|
-
in the Software without restriction, including without limitation the rights
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
9
|
-
furnished to do so, subject to the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be included in all
|
12
|
-
copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
-
SOFTWARE.
|
21
|
-
=end
|
22
|
-
|
23
|
-
module AsposeSlidesCloud
|
24
|
-
class SpecUtils
|
25
|
-
def self.initialize(method, name, value)
|
26
|
-
if !@@is_initialized
|
27
|
-
version = ""
|
28
|
-
begin
|
29
|
-
version = SpecUtils.api.download_file("TempTests/version.txt")
|
30
|
-
rescue AsposeSlidesCloud::ApiError => e
|
31
|
-
if e.code != 404
|
32
|
-
fail "Could not read from storage"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
if version != EXPECTED_TEST_DATA_VERSION
|
36
|
-
Dir.entries(TEST_DATA_PATH).each { |f|
|
37
|
-
if !File.directory? File.join(TEST_DATA_PATH, f)
|
38
|
-
fd = File.binread(File.join(TEST_DATA_PATH, f))
|
39
|
-
SpecUtils.api.upload_file("TempTests/" + f, fd)
|
40
|
-
end
|
41
|
-
}
|
42
|
-
SpecUtils.api.upload_file("TempTests/version.txt", EXPECTED_TEST_DATA_VERSION)
|
43
|
-
end
|
44
|
-
@@is_initialized = true
|
45
|
-
end
|
46
|
-
files = Hash.new
|
47
|
-
SpecUtils.test_rules["Files"].each do |rule|
|
48
|
-
if SpecUtils.good_rule?(rule, name, method)
|
49
|
-
actual_name = SpecUtils.untemplatize(rule["File"], value)
|
50
|
-
path = "TempSlidesSDK"
|
51
|
-
if rule.key?("Folder")
|
52
|
-
path = SpecUtils.untemplatize(rule["Folder"], value)
|
53
|
-
end
|
54
|
-
path = path + "/" + actual_name
|
55
|
-
files[path] = rule
|
56
|
-
rule["ActualName"] = actual_name
|
57
|
-
end
|
58
|
-
end
|
59
|
-
files.each do |path, rule|
|
60
|
-
if rule["Action"] == "Put"
|
61
|
-
SpecUtils.api.copy_file("TempTests/" + rule['ActualName'], path)
|
62
|
-
elsif rule["Action"] == "Delete"
|
63
|
-
SpecUtils.api.delete_file(path)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.get_param_value(name, method, type)
|
69
|
-
if type == 'File'
|
70
|
-
fileName = "test.pptx"
|
71
|
-
if method.casecmp("ImportFromPdf") == 0
|
72
|
-
fileName = "test.pdf"
|
73
|
-
elsif name.casecmp("Image") == 0
|
74
|
-
fileName = "watermark.png"
|
75
|
-
end
|
76
|
-
return File.binread(File.join(TEST_DATA_PATH, fileName))
|
77
|
-
end
|
78
|
-
if type == 'File[]'
|
79
|
-
files = []
|
80
|
-
files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test.pptx")))
|
81
|
-
files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test-unprotected.pptx")))
|
82
|
-
return files
|
83
|
-
end
|
84
|
-
value = "test" + name
|
85
|
-
SpecUtils.test_rules["Values"].each do |rule|
|
86
|
-
if SpecUtils.good_rule?(rule, name, method) and rule.key?("Value")
|
87
|
-
if rule.key?("Type")
|
88
|
-
if TypeRegistry.subclass?(rule["Type"], type)
|
89
|
-
value = rule["Value"]
|
90
|
-
end
|
91
|
-
else
|
92
|
-
value = rule["Value"]
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
value
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.invalidize_param_value(name, method, value, type)
|
100
|
-
if type == 'File'
|
101
|
-
return nil
|
102
|
-
end
|
103
|
-
invalid_value = nil
|
104
|
-
SpecUtils.test_rules["Values"].each do |rule|
|
105
|
-
if SpecUtils.good_rule?(rule, name, method) and rule.key?("InvalidValue")
|
106
|
-
invalid_value = rule["InvalidValue"]
|
107
|
-
end
|
108
|
-
end
|
109
|
-
SpecUtils.untemplatize(invalid_value, value)
|
110
|
-
end
|
111
|
-
|
112
|
-
def self.get_expected_error(method, name, value)
|
113
|
-
code = 0
|
114
|
-
message = "Unexpeceted message"
|
115
|
-
SpecUtils.test_rules["Results"].each do |rule|
|
116
|
-
if SpecUtils.good_rule?(rule, name, method)
|
117
|
-
if rule.key?("Code")
|
118
|
-
code = rule["Code"]
|
119
|
-
end
|
120
|
-
if rule.key?("Message")
|
121
|
-
message = SpecUtils.untemplatize(rule["Message"], value)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
return code, message
|
126
|
-
end
|
127
|
-
|
128
|
-
def self.no_exception?(method, name)
|
129
|
-
SpecUtils.test_rules["OKToNotFail"].each do |rule|
|
130
|
-
return true
|
131
|
-
end
|
132
|
-
return false
|
133
|
-
end
|
134
|
-
|
135
|
-
def self.good_rule?(rule, name, method)
|
136
|
-
(not rule.key?("Language") or rule["Language"].casecmp("Ruby") == 0) \
|
137
|
-
and (not rule.key?("Invalid") or ((name != nil) == rule["Invalid"])) \
|
138
|
-
and (not rule.key?("Parameter") or (name != nil and rule["Parameter"].casecmp(name) == 0)) \
|
139
|
-
and (not rule.key?("Method") or (method != nil and rule["Method"].casecmp(method) == 0))
|
140
|
-
end
|
141
|
-
|
142
|
-
def self.untemplatize(template, value)
|
143
|
-
if template == nil
|
144
|
-
value
|
145
|
-
else
|
146
|
-
result = template
|
147
|
-
if template.is_a? String and template.match("%v")
|
148
|
-
result = "" + template
|
149
|
-
if value != nil
|
150
|
-
result["%v"] = value.to_s
|
151
|
-
else
|
152
|
-
result["%v"] = ""
|
153
|
-
end
|
154
|
-
end
|
155
|
-
result
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
def self.test_rules
|
160
|
-
unless @@test_rules
|
161
|
-
@@test_rules = JSON.parse(File.read('testRules.json'))
|
162
|
-
end
|
163
|
-
@@test_rules
|
164
|
-
end
|
165
|
-
|
166
|
-
@@test_rules = nil
|
167
|
-
|
168
|
-
def self.api
|
169
|
-
unless @@api
|
170
|
-
config = JSON.parse(File.read('testConfig.json'))
|
171
|
-
configuration = AsposeSlidesCloud::Configuration.new
|
172
|
-
configuration.base_url = config["BaseUrl"]
|
173
|
-
configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
|
174
|
-
configuration.app_sid = config["ClientId"]
|
175
|
-
configuration.app_key = config["ClientSecret"]
|
176
|
-
configuration.debugging = config["Debug"]
|
177
|
-
@@api = AsposeSlidesCloud::SlidesApi.new(configuration)
|
178
|
-
end
|
179
|
-
@@api
|
180
|
-
end
|
181
|
-
|
182
|
-
@@api = nil
|
183
|
-
@@is_initialized = false
|
184
|
-
|
185
|
-
TEST_DATA_PATH = "TestData"
|
186
|
-
EXPECTED_TEST_DATA_VERSION = "1"
|
187
|
-
end
|
188
|
-
end
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2019 Aspose Pty Ltd
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
+
SOFTWARE.
|
21
|
+
=end
|
22
|
+
|
23
|
+
module AsposeSlidesCloud
|
24
|
+
class SpecUtils
|
25
|
+
def self.initialize(method, name, value)
|
26
|
+
if !@@is_initialized
|
27
|
+
version = ""
|
28
|
+
begin
|
29
|
+
version = SpecUtils.api.download_file("TempTests/version.txt")
|
30
|
+
rescue AsposeSlidesCloud::ApiError => e
|
31
|
+
if e.code != 404
|
32
|
+
fail "Could not read from storage"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if version != EXPECTED_TEST_DATA_VERSION
|
36
|
+
Dir.entries(TEST_DATA_PATH).each { |f|
|
37
|
+
if !File.directory? File.join(TEST_DATA_PATH, f)
|
38
|
+
fd = File.binread(File.join(TEST_DATA_PATH, f))
|
39
|
+
SpecUtils.api.upload_file("TempTests/" + f, fd)
|
40
|
+
end
|
41
|
+
}
|
42
|
+
SpecUtils.api.upload_file("TempTests/version.txt", EXPECTED_TEST_DATA_VERSION)
|
43
|
+
end
|
44
|
+
@@is_initialized = true
|
45
|
+
end
|
46
|
+
files = Hash.new
|
47
|
+
SpecUtils.test_rules["Files"].each do |rule|
|
48
|
+
if SpecUtils.good_rule?(rule, name, method)
|
49
|
+
actual_name = SpecUtils.untemplatize(rule["File"], value)
|
50
|
+
path = "TempSlidesSDK"
|
51
|
+
if rule.key?("Folder")
|
52
|
+
path = SpecUtils.untemplatize(rule["Folder"], value)
|
53
|
+
end
|
54
|
+
path = path + "/" + actual_name
|
55
|
+
files[path] = rule
|
56
|
+
rule["ActualName"] = actual_name
|
57
|
+
end
|
58
|
+
end
|
59
|
+
files.each do |path, rule|
|
60
|
+
if rule["Action"] == "Put"
|
61
|
+
SpecUtils.api.copy_file("TempTests/" + rule['ActualName'], path)
|
62
|
+
elsif rule["Action"] == "Delete"
|
63
|
+
SpecUtils.api.delete_file(path)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.get_param_value(name, method, type)
|
69
|
+
if type == 'File'
|
70
|
+
fileName = "test.pptx"
|
71
|
+
if method.casecmp("ImportFromPdf") == 0
|
72
|
+
fileName = "test.pdf"
|
73
|
+
elsif name.casecmp("Image") == 0
|
74
|
+
fileName = "watermark.png"
|
75
|
+
end
|
76
|
+
return File.binread(File.join(TEST_DATA_PATH, fileName))
|
77
|
+
end
|
78
|
+
if type == 'File[]'
|
79
|
+
files = []
|
80
|
+
files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test.pptx")))
|
81
|
+
files.push(File.binread(File.join(AsposeSlidesCloud::SpecUtils::TEST_DATA_PATH, "test-unprotected.pptx")))
|
82
|
+
return files
|
83
|
+
end
|
84
|
+
value = "test" + name
|
85
|
+
SpecUtils.test_rules["Values"].each do |rule|
|
86
|
+
if SpecUtils.good_rule?(rule, name, method) and rule.key?("Value")
|
87
|
+
if rule.key?("Type")
|
88
|
+
if TypeRegistry.subclass?(rule["Type"], type)
|
89
|
+
value = rule["Value"]
|
90
|
+
end
|
91
|
+
else
|
92
|
+
value = rule["Value"]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
value
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.invalidize_param_value(name, method, value, type)
|
100
|
+
if type == 'File'
|
101
|
+
return nil
|
102
|
+
end
|
103
|
+
invalid_value = nil
|
104
|
+
SpecUtils.test_rules["Values"].each do |rule|
|
105
|
+
if SpecUtils.good_rule?(rule, name, method) and rule.key?("InvalidValue")
|
106
|
+
invalid_value = rule["InvalidValue"]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
SpecUtils.untemplatize(invalid_value, value)
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.get_expected_error(method, name, value)
|
113
|
+
code = 0
|
114
|
+
message = "Unexpeceted message"
|
115
|
+
SpecUtils.test_rules["Results"].each do |rule|
|
116
|
+
if SpecUtils.good_rule?(rule, name, method)
|
117
|
+
if rule.key?("Code")
|
118
|
+
code = rule["Code"]
|
119
|
+
end
|
120
|
+
if rule.key?("Message")
|
121
|
+
message = SpecUtils.untemplatize(rule["Message"], value)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
return code, message
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.no_exception?(method, name)
|
129
|
+
SpecUtils.test_rules["OKToNotFail"].each do |rule|
|
130
|
+
return true
|
131
|
+
end
|
132
|
+
return false
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.good_rule?(rule, name, method)
|
136
|
+
(not rule.key?("Language") or rule["Language"].casecmp("Ruby") == 0) \
|
137
|
+
and (not rule.key?("Invalid") or ((name != nil) == rule["Invalid"])) \
|
138
|
+
and (not rule.key?("Parameter") or (name != nil and rule["Parameter"].casecmp(name) == 0)) \
|
139
|
+
and (not rule.key?("Method") or (method != nil and rule["Method"].casecmp(method) == 0))
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.untemplatize(template, value)
|
143
|
+
if template == nil
|
144
|
+
value
|
145
|
+
else
|
146
|
+
result = template
|
147
|
+
if template.is_a? String and template.match("%v")
|
148
|
+
result = "" + template
|
149
|
+
if value != nil
|
150
|
+
result["%v"] = value.to_s
|
151
|
+
else
|
152
|
+
result["%v"] = ""
|
153
|
+
end
|
154
|
+
end
|
155
|
+
result
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.test_rules
|
160
|
+
unless @@test_rules
|
161
|
+
@@test_rules = JSON.parse(File.read('testRules.json'))
|
162
|
+
end
|
163
|
+
@@test_rules
|
164
|
+
end
|
165
|
+
|
166
|
+
@@test_rules = nil
|
167
|
+
|
168
|
+
def self.api
|
169
|
+
unless @@api
|
170
|
+
config = JSON.parse(File.read('testConfig.json'))
|
171
|
+
configuration = AsposeSlidesCloud::Configuration.new
|
172
|
+
configuration.base_url = config["BaseUrl"]
|
173
|
+
configuration.auth_base_url = config["AuthBaseUrl"] ? config["AuthBaseUrl"] : config["BaseUrl"]
|
174
|
+
configuration.app_sid = config["ClientId"]
|
175
|
+
configuration.app_key = config["ClientSecret"]
|
176
|
+
configuration.debugging = config["Debug"]
|
177
|
+
@@api = AsposeSlidesCloud::SlidesApi.new(configuration)
|
178
|
+
end
|
179
|
+
@@api
|
180
|
+
end
|
181
|
+
|
182
|
+
@@api = nil
|
183
|
+
@@is_initialized = false
|
184
|
+
|
185
|
+
TEST_DATA_PATH = "TestData"
|
186
|
+
EXPECTED_TEST_DATA_VERSION = "1"
|
187
|
+
end
|
188
|
+
end
|