aspose_html 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +12 -0
  3. data/Gemfile.lock +92 -0
  4. data/LICENSE +21 -0
  5. data/README.md +181 -0
  6. data/Rakefile +8 -0
  7. data/aspose_html.gemspec +58 -0
  8. data/docs/ConversionApi.md +837 -0
  9. data/docs/DocumentApi.md +386 -0
  10. data/docs/OcrApi.md +128 -0
  11. data/docs/SummarizationApi.md +111 -0
  12. data/docs/TranslationApi.md +126 -0
  13. data/docs/storage/DiscUsage.md +9 -0
  14. data/docs/storage/DiscUsageResponse.md +10 -0
  15. data/docs/storage/FileApi.md +240 -0
  16. data/docs/storage/FileDetail.md +13 -0
  17. data/docs/storage/FileDetailsResponse.md +10 -0
  18. data/docs/storage/FileExist.md +9 -0
  19. data/docs/storage/FileExistResponse.md +10 -0
  20. data/docs/storage/FileVersion.md +15 -0
  21. data/docs/storage/FileVersionsResponse.md +10 -0
  22. data/docs/storage/FolderApi.md +229 -0
  23. data/docs/storage/MessageResponse.md +9 -0
  24. data/docs/storage/MoveFileResponse.md +9 -0
  25. data/docs/storage/MoveFolderResponse.md +9 -0
  26. data/docs/storage/RemoveFileResponse.md +9 -0
  27. data/docs/storage/RemoveFolderResponse.md +9 -0
  28. data/docs/storage/StorageApi.md +217 -0
  29. data/docs/storage/StorageExistResponse.md +10 -0
  30. data/lib/aspose_html.rb +68 -0
  31. data/lib/aspose_html/api/html_api.rb +1900 -0
  32. data/lib/aspose_html/api/storage_api.rb +774 -0
  33. data/lib/aspose_html/api_client.rb +386 -0
  34. data/lib/aspose_html/api_error.rb +54 -0
  35. data/lib/aspose_html/configuration.rb +175 -0
  36. data/lib/aspose_html/models/disc_usage.rb +223 -0
  37. data/lib/aspose_html/models/disc_usage_response.rb +260 -0
  38. data/lib/aspose_html/models/file_detail.rb +254 -0
  39. data/lib/aspose_html/models/file_details_response.rb +262 -0
  40. data/lib/aspose_html/models/file_exist.rb +223 -0
  41. data/lib/aspose_html/models/file_exist_response.rb +274 -0
  42. data/lib/aspose_html/models/file_version.rb +273 -0
  43. data/lib/aspose_html/models/file_versions_response.rb +262 -0
  44. data/lib/aspose_html/models/message_response.rb +251 -0
  45. data/lib/aspose_html/models/move_file_response.rb +251 -0
  46. data/lib/aspose_html/models/move_folder_response.rb +251 -0
  47. data/lib/aspose_html/models/remove_file_response.rb +251 -0
  48. data/lib/aspose_html/models/remove_folder_response.rb +251 -0
  49. data/lib/aspose_html/models/storage_exist_response.rb +260 -0
  50. data/lib/aspose_html/version.rb +31 -0
  51. data/spec/api/html_api_spec.rb +971 -0
  52. data/spec/api/model_spec.rb +622 -0
  53. data/spec/api/storage_api_spec.rb +596 -0
  54. data/spec/spec_helper.rb +169 -0
  55. data/testdata/test.txt +1 -0
  56. data/testdata/test1.html +19 -0
  57. data/testdata/test1.html.zip +0 -0
  58. data/testdata/test2.html +46 -0
  59. data/testdata/test2.html.zip +0 -0
  60. data/testdata/test3.html.zip +0 -0
  61. data/testdata/test4.html.zip +0 -0
  62. data/testdata/test_download.jpg +0 -0
  63. data/testdata/test_en.html +46 -0
  64. data/testdata/test_for_delete.html +46 -0
  65. data/testdata/test_for_move.html +46 -0
  66. data/testdata/test_get_doc.zip +0 -0
  67. data/testdata/test_ocr.jpg +0 -0
  68. data/testdata/test_ocr.png +0 -0
  69. data/testdata/test_put_create.html +19 -0
  70. data/testdata/test_put_create.jpg +0 -0
  71. data/testresult/Convert_html.bmp +0 -0
  72. data/testresult/Convert_html.pdf +0 -0
  73. data/testresult/Convert_html.xps +0 -0
  74. data/testresult/Convert_url.pdf +0 -0
  75. data/testresult/Convert_url.png +0 -0
  76. data/testresult/Convert_url.xps +0 -0
  77. data/testresult/Get_document.zip +0 -0
  78. data/testresult/Get_fragment_css_by_url.html +447 -0
  79. data/testresult/Get_fragment_doc.html +9 -0
  80. data/testresult/Get_fragment_doc_css.html +9 -0
  81. data/testresult/Get_fragment_xpath_by_url.html +38 -0
  82. data/testresult/Get_images_doc.zip +0 -0
  83. data/testresult/Get_images_from_url.zip +0 -0
  84. data/testresult/Keyword_by_doc.json +1 -0
  85. data/testresult/Keyword_by_url.json +1 -0
  86. data/testresult/Recognize_en_png.html +10 -0
  87. data/testresult/Translate_url_en_fr.zip +0 -0
  88. data/testresult/putTest.pdf +0 -0
  89. data/testresult/putTest.png +0 -0
  90. data/testresult/putTest.xps +0 -0
  91. data/testresult/putTestDoc.pdf +0 -0
  92. data/testresult/putTestDoc.tiff +0 -0
  93. data/testresult/putTestDoc.xps +0 -0
  94. data/testresult/test_download.jpg +0 -0
  95. metadata +320 -0
@@ -0,0 +1,596 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ --------------------------------------------------------------------------------------------------------------------
4
+ <copyright company="Aspose" file="storage_api_spec.rb">
5
+ </copyright>
6
+ Copyright (c) 2018 Aspose.HTML for Cloud
7
+ <summary>
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ </summary>
26
+ --------------------------------------------------------------------------------------------------------------------
27
+ =end
28
+
29
+ require 'spec_helper'
30
+ require 'json'
31
+
32
+ describe 'Test Storage API' do
33
+ before(:all) do
34
+ # run before all tests
35
+ @api = AsposeHtml::StorageApi.new CONFIG
36
+ end
37
+
38
+ describe 'test an instance of StorageApi' do
39
+ it 'should create an instance of StorageApi' do
40
+ expect(@api).to be_instance_of(AsposeHtml::StorageApi)
41
+ end
42
+ end
43
+
44
+ #################################################
45
+ # Storage API
46
+ #################################################
47
+
48
+ # unit tests for get_disc_usage
49
+ # Check the disk usage of the current account
50
+ #
51
+ # @param [Hash] opts the optional parameters
52
+ # @option opts [String] :storage User&#39;s storage name
53
+ # @return [DiscUsageResponse]
54
+ describe 'get_disc_usage test' do
55
+ it "must be {Code: 200, Status:'OK', DiscUsage:{UsedSize: num, TotalSize: num}}" do
56
+ opts = {storage: nil}
57
+
58
+ res = @api.get_disc_usage(opts)
59
+
60
+ expect(res.code).to eql(200)
61
+ expect(res.status).to eql("OK")
62
+
63
+ expect(res).to be_an_instance_of AsposeHtml::DiscUsageResponse
64
+ expect(res.code).to be_an_instance_of Integer
65
+ expect(res.status).to be_an_instance_of String
66
+ expect(res.disc_usage).to be_an_instance_of AsposeHtml::DiscUsage
67
+ expect(res.disc_usage.used_size).to be_an_instance_of Integer
68
+ expect(res.disc_usage.total_size).to be_an_instance_of Integer
69
+ end
70
+ end
71
+
72
+ # unit tests for get_is_exist
73
+ # Check if a specific file or folder exists
74
+ #
75
+ # @param path File or folder path e.g. /file.ext or /Folder1
76
+ # @param [Hash] opts the optional parameters
77
+ # @option opts [String] :version_id File&#39;s version
78
+ # @option opts [String] :storage User&#39;s storage name
79
+ # @return [FileExistResponse]
80
+ describe 'get_is_exist test' do
81
+ it "must be {Code: 200, Status:'OK', FileExist:{IsExist: true, IsFolder: false}}" do
82
+
83
+ name = "test3.html.zip"
84
+
85
+ # Upload file to server
86
+ res = upload_file(name)
87
+ expect(res.code).to eql(200)
88
+
89
+ path = "HtmlTestDoc/" + name
90
+ opts = {storage: nil, version_id: nil}
91
+
92
+ res = @api.get_is_exist(path, opts)
93
+
94
+ expect(res.code).to eql(200)
95
+ expect(res.status).to eql("OK")
96
+
97
+ expect(res).to be_an_instance_of AsposeHtml::FileExistResponse
98
+ expect(res.code).to be_an_instance_of Integer
99
+ expect(res.status).to be_an_instance_of String
100
+ expect(res.file_exist).to be_an_instance_of AsposeHtml::FileExist
101
+ expect(res.file_exist.is_exist).to be true
102
+ expect(res.file_exist.is_folder).to be false
103
+ end
104
+
105
+ it "must be {Code: 200, Status:'OK', FileExist:{IsExist: false, IsFolder: false}}" do
106
+
107
+ path = "/non_exist_file.ext"
108
+ opts = {storage: nil, version_id: nil}
109
+
110
+ res = @api.get_is_exist(path, opts)
111
+
112
+ expect(res.code).to eql(200)
113
+ expect(res.status).to eql("OK")
114
+
115
+ expect(res).to be_an_instance_of AsposeHtml::FileExistResponse
116
+ expect(res.code).to be_an_instance_of Integer
117
+ expect(res.status).to be_an_instance_of String
118
+ expect(res.file_exist).to be_an_instance_of AsposeHtml::FileExist
119
+ expect(res.file_exist.is_exist).to be false
120
+ expect(res.file_exist.is_folder).to be false
121
+ end
122
+ end
123
+
124
+ # unit tests for get_is_storage_exist
125
+ # Check if storage exists
126
+ #
127
+ # @param name Storage name
128
+ # @return [StorageExistResponse]
129
+ describe 'get_is_storage_exist test' do
130
+ it "must be {'Code': 200, 'Status': 'OK', 'IsExist':false}" do
131
+
132
+ res = @api.get_is_storage_exist('non_exist_storage')
133
+
134
+ expect(res.code).to eql(200)
135
+ expect(res.status).to eql("OK")
136
+
137
+ expect(res).to be_an_instance_of AsposeHtml::StorageExistResponse
138
+ expect(res.code).to be_an_instance_of Integer
139
+ expect(res.status).to be_an_instance_of String
140
+ expect(res.is_exist).to be false
141
+ end
142
+ end
143
+
144
+ # unit tests for get_list_file_versions
145
+ # Get the file&#39;s versions list
146
+ #
147
+ # @param path File path e.g. /file.ext or /Folder1/file.ext
148
+ # @param [Hash] opts the optional parameters
149
+ # @option opts [String] :storage User&#39;s storage name
150
+ # @return [FileVersionsResponse]
151
+ describe 'get_list_file_versions test' do
152
+ it "must be {'Code': 200, 'Status': 'OK', 'FileVertsions':[...]}" do
153
+
154
+ name = "test1.html"
155
+
156
+ # Upload files to server
157
+ res = upload_file(name)
158
+ expect(res.code).to eql(200)
159
+
160
+ res = upload_file(name)
161
+ expect(res.code).to eql(200)
162
+
163
+ res = upload_file(name)
164
+ expect(res.code).to eql(200)
165
+
166
+ path = "HtmlTestDoc/" + name
167
+ opts = {storage: nil}
168
+
169
+ res = @api.get_list_file_versions(path, opts)
170
+
171
+ expect(res.code).to eql(200)
172
+ expect(res.status).to eql("OK")
173
+
174
+ expect(res).to be_an_instance_of AsposeHtml::FileVersionsResponse
175
+ expect(res.code).to be_an_instance_of Integer
176
+ expect(res.status).to be_an_instance_of String
177
+ expect(res.file_versions).to be_an_instance_of Array
178
+ expect(res.file_versions[0]).to be_an_instance_of AsposeHtml::FileVersion
179
+ end
180
+ end
181
+
182
+ #################################################
183
+ # File API
184
+ #################################################
185
+
186
+ # unit tests for delete_file
187
+ # Remove a specific file
188
+ #
189
+ # @param path Path of the file including file name and extension e.g. /Folder1/file.ext
190
+ # @param [Hash] opts the optional parameters
191
+ # @option opts [String] :version_id File&#39;s version
192
+ # @option opts [String] :storage User&#39;s storage name
193
+ # @return [RemoveFileResponse]
194
+ describe 'delete_file test' do
195
+ it "must be {'Code': 200, 'Status': 'OK'}" do
196
+ name = "test_for_delete.html"
197
+
198
+ # Upload files to server
199
+ res = upload_file(name)
200
+ expect(res.code).to eql(200)
201
+
202
+ path = "HtmlTestDoc/" + name
203
+ opts = {storage: nil, version_id: nil}
204
+
205
+ res = @api.delete_file(path, opts)
206
+
207
+ expect(res.code).to eql(200)
208
+ expect(res.status).to eql("OK")
209
+
210
+ # Check result
211
+ res = @api.get_is_exist(path, opts)
212
+
213
+ expect(res.code).to eql(200)
214
+ expect(res.status).to eql("OK")
215
+
216
+ expect(res.file_exist.is_exist).to be false
217
+ expect(res.file_exist.is_folder).to be false
218
+ end
219
+ end
220
+
221
+ # unit tests for get_download
222
+ # Download a specific file
223
+ #
224
+ # @param path Path of the file including the file name and extension e.g. /file.ext
225
+ # @param [Hash] opts the optional parameters
226
+ # @option opts [String] :version_id File&#39;s version
227
+ # @option opts [String] :storage User&#39;s storage name
228
+ # @return {file: path_to_tmp_file, code: 200, status: 'OK'}
229
+ describe 'get_download test' do
230
+ it "must be {file: path_to_tmp_file, code: 200, status: 'OK'}" do
231
+ name = "test_download.jpg"
232
+
233
+ # Upload files to server
234
+ res = upload_file(name)
235
+ expect(res.code).to eql(200)
236
+
237
+ path = "HtmlTestDoc/" + name
238
+ opts = {storage: nil, version_id: nil}
239
+
240
+ size_src = get_file_size(name)
241
+
242
+ res = @api.get_download(path, opts)
243
+
244
+ expect(res[:code]).to eql(200)
245
+ expect(res[:status]).to eql("OK")
246
+ expect(res[:file]).to be_an_instance_of File
247
+
248
+ expect(File.size(res[:file].to_path)).to eql size_src
249
+
250
+ #Move to test folder
251
+ save_to_test_dir(res, name)
252
+ end
253
+ end
254
+
255
+ # unit tests for post_move_file
256
+ # Move a specific file
257
+ #
258
+ # @param src Source file path e.g. /fileSource.ext
259
+ # @param dest Destination file path e.g. /fileDestination.ext
260
+ # @param [Hash] opts the optional parameters
261
+ # @option opts [String] :version_id Source file&#39;s version,
262
+ # @option opts [String] :storage User&#39;s source storage name
263
+ # @option opts [String] :dest_storage User&#39;s destination storage name
264
+ # @return [MoveFileResponse]
265
+ describe 'post_move_file test' do
266
+ it "must be {'Code': 200, 'Status': 'OK'}" do
267
+ name = "test_for_move.html"
268
+
269
+ # Upload files to server
270
+ res = upload_file(name)
271
+ expect(res.code).to eql(200)
272
+
273
+ src = "HtmlTestDoc/" + name
274
+ dest = "HtmlTestDoc/test_moved.html"
275
+
276
+ opts = {storage: nil, dest_storage: nil, version_id: nil}
277
+
278
+ res = @api.post_move_file(src, dest, opts)
279
+
280
+ expect(res.code).to eql(200)
281
+ expect(res.status).to eql("OK")
282
+
283
+ # Check result destination
284
+ res = @api.get_is_exist(dest)
285
+
286
+ expect(res.code).to eql(200)
287
+ expect(res.status).to eql("OK")
288
+
289
+ expect(res.file_exist.is_exist).to be true
290
+ expect(res.file_exist.is_folder).to be false
291
+
292
+ # Check result source
293
+ res = @api.get_is_exist(src)
294
+
295
+ expect(res.code).to eql(200)
296
+ expect(res.status).to eql("OK")
297
+
298
+ expect(res.file_exist.is_exist).to be false
299
+ expect(res.file_exist.is_folder).to be false
300
+ end
301
+ end
302
+
303
+ # unit tests for put_create
304
+ # Upload a specific file
305
+ #
306
+ # @param path Path where to upload including filename and extension e.g. /file.ext or /Folder 1/file.ext
307
+ # @param file File to upload
308
+ # @param [Hash] opts the optional parameters
309
+ # @option opts [String] :version_id Source file&#39;s version
310
+ # @option opts [String] :storage User&#39;s storage name
311
+ # @return [MessageResponse]
312
+ describe 'put_create test' do
313
+ it "must be {'Code': 200, 'Status': 'OK'}" do
314
+ name = "test_put_create.html"
315
+
316
+ path = "HtmlTestDoc/" + name
317
+ file = File.realpath(__dir__ + '/../../testdata/' + name)
318
+
319
+ opts = {storage: nil, version_id: nil}
320
+
321
+ # Check before
322
+ res = @api.get_is_exist(path, opts)
323
+
324
+ expect(res.code).to eql(200)
325
+ expect(res.status).to eql("OK")
326
+
327
+ expect(res.file_exist.is_exist).to be false
328
+ expect(res.file_exist.is_folder).to be false
329
+
330
+ res = @api.put_create(path, file, opts)
331
+
332
+ expect(res.code).to eql(200)
333
+ expect(res.status).to eql("OK")
334
+
335
+ # Check after
336
+ res = @api.get_is_exist(path, opts)
337
+
338
+ expect(res.code).to eql(200)
339
+ expect(res.status).to eql("OK")
340
+
341
+ expect(res.file_exist.is_exist).to be true
342
+ expect(res.file_exist.is_folder).to be false
343
+
344
+ # clear
345
+ res = @api.delete_file(path, opts)
346
+
347
+ expect(res.code).to eql(200)
348
+ expect(res.status).to eql("OK")
349
+
350
+ # Check after clear
351
+ res = @api.get_is_exist(path, opts)
352
+
353
+ expect(res.code).to eql(200)
354
+ expect(res.status).to eql("OK")
355
+
356
+ expect(res.file_exist.is_exist).to be false
357
+ expect(res.file_exist.is_folder).to be false
358
+ end
359
+ end
360
+
361
+ #################################################
362
+ # Folder API
363
+ #################################################
364
+
365
+ # unit tests for put_create_folder
366
+ # Create the folder
367
+ #
368
+ # @param path Target folder&#39;s path e.g. Folder1/Folder2/. The folders will be created recursively
369
+ # @param [Hash] opts the optional parameters
370
+ # @option opts [String] :storage User&#39;s source storage name
371
+ # @option opts [String] :dest_storage User&#39;s destination storage name
372
+ # @return [MessageResponse]
373
+ describe 'put_create_folder test' do
374
+ it "must be {'Code': 200, 'Status': 'OK'}" do
375
+
376
+ path = "HtmlTestDoc/testFolder1/testFolder2/testFolder3"
377
+
378
+ opts_exist = {storage: nil, version_id: nil}
379
+
380
+ # Check before
381
+ res = @api.get_is_exist(path, opts_exist)
382
+
383
+ expect(res.code).to eql(200)
384
+ expect(res.status).to eql("OK")
385
+
386
+ expect(res.file_exist.is_exist).to be false
387
+ expect(res.file_exist.is_folder).to be false
388
+
389
+ opts_folder = {storage: nil, dest_storage: nil}
390
+
391
+ res = @api.put_create_folder(path, opts_folder)
392
+
393
+ expect(res.code).to eql(200)
394
+ expect(res.status).to eql("OK")
395
+
396
+ # Check after
397
+ res = @api.get_is_exist(path, opts_exist)
398
+
399
+ expect(res.code).to eql(200)
400
+ expect(res.status).to eql("OK")
401
+
402
+ expect(res.file_exist.is_exist).to be true
403
+ expect(res.file_exist.is_folder).to be true
404
+
405
+ # clear
406
+ path = "HtmlTestDoc/testFolder1"
407
+ opts_delete = {storage: nil, recursive: true}
408
+
409
+ res = @api.delete_folder(path, opts_delete)
410
+
411
+ expect(res.code).to eql(200)
412
+ expect(res.status).to eql("OK")
413
+
414
+ # Check after clear
415
+ res = @api.get_is_exist(path, opts_exist)
416
+
417
+ expect(res.code).to eql(200)
418
+ expect(res.status).to eql("OK")
419
+
420
+ expect(res.file_exist.is_exist).to be false
421
+ expect(res.file_exist.is_folder).to be false
422
+ end
423
+ end
424
+
425
+ # unit tests for delete_folder
426
+ # Remove a specific folder
427
+ #
428
+ # @param path Folder path e.g. /Folder1
429
+ # @param [Hash] opts the optional parameters
430
+ # @option opts [String] :storage User&#39;s storage name
431
+ # @option opts [BOOLEAN] :recursive Remove recursivelly inner folder/files. If false and folder contains data than exception is raised.
432
+ # @return [RemoveFolderResponse]
433
+ describe 'delete_folder test' do
434
+ it "must be {'Code': 200, 'Status': 'OK'}" do
435
+
436
+ path = "HtmlTestDoc/testFolder1/testFolder2/testFolder3"
437
+
438
+ opts_exist = {storage: nil, version_id: nil}
439
+
440
+ # Check before
441
+ res = @api.get_is_exist(path, opts_exist)
442
+
443
+ expect(res.code).to eql(200)
444
+ expect(res.status).to eql("OK")
445
+
446
+ expect(res.file_exist.is_exist).to be false
447
+ expect(res.file_exist.is_folder).to be false
448
+
449
+ opts_folder = {storage: nil, dest_storage: nil}
450
+
451
+ res = @api.put_create_folder(path, opts_folder)
452
+
453
+ expect(res.code).to eql(200)
454
+ expect(res.status).to eql("OK")
455
+
456
+ # Check after
457
+ res = @api.get_is_exist(path, opts_exist)
458
+
459
+ expect(res.code).to eql(200)
460
+ expect(res.status).to eql("OK")
461
+
462
+ expect(res.file_exist.is_exist).to be true
463
+ expect(res.file_exist.is_folder).to be true
464
+
465
+ # Test delete folder
466
+ path = "HtmlTestDoc/testFolder1"
467
+ opts_delete = {storage: nil, recursive: true}
468
+
469
+ res = @api.delete_folder(path, opts_delete)
470
+
471
+ expect(res).to be_instance_of(AsposeHtml::RemoveFolderResponse)
472
+ expect(res.code).to eql(200)
473
+ expect(res.status).to eql("OK")
474
+
475
+ # Check after clear
476
+ res = @api.get_is_exist(path, opts_exist)
477
+
478
+ expect(res.code).to eql(200)
479
+ expect(res.status).to eql("OK")
480
+
481
+ expect(res.file_exist.is_exist).to be false
482
+ expect(res.file_exist.is_folder).to be false
483
+ end
484
+ end
485
+
486
+ # unit tests for post_move_folder
487
+ # Move a specific folder
488
+ #
489
+ # @param src Source folder path e.g. /Folder1
490
+ # @param dest Destination folder path e.g. /Folder2
491
+ # @param [Hash] opts the optional parameters
492
+ # @option opts [String] :storage User&#39;s source storage name
493
+ # @option opts [String] :dest_storage User&#39;s destination storage name
494
+ # @return [MoveFolderResponse]
495
+ describe 'post_move_folder test' do
496
+ it "must be {'Code': 200, 'Status': 'OK'}" do
497
+
498
+ src = "HtmlTestDoc/testSourceFolder"
499
+ opts_exist = {storage: nil, version_id: nil}
500
+
501
+ # Check before
502
+ res = @api.get_is_exist(src, opts_exist)
503
+
504
+ expect(res.code).to eql(200)
505
+ expect(res.status).to eql("OK")
506
+
507
+ expect(res.file_exist.is_exist).to be false
508
+ expect(res.file_exist.is_folder).to be false
509
+
510
+ opts_folder = {storage: nil, dest_storage: nil}
511
+
512
+ # Create test folder
513
+ res = @api.put_create_folder(src, opts_folder)
514
+
515
+ expect(res.code).to eql(200)
516
+ expect(res.status).to eql("OK")
517
+
518
+ # Check after
519
+ res = @api.get_is_exist(src, opts_exist)
520
+
521
+ expect(res.code).to eql(200)
522
+ expect(res.status).to eql("OK")
523
+
524
+ expect(res.file_exist.is_exist).to be true
525
+ expect(res.file_exist.is_folder).to be true
526
+
527
+ # Test move folder
528
+ dst = "HtmlTestDoc/MovedFolder"
529
+ opts_move = {storage: nil, dest_storage: nil}
530
+
531
+ res = @api.post_move_folder(src, dst, opts_move)
532
+
533
+ expect(res).to be_instance_of(AsposeHtml::MoveFolderResponse)
534
+ expect(res.code).to eql(200)
535
+ expect(res.status).to eql("OK")
536
+
537
+ # Check src after move
538
+ res = @api.get_is_exist(src, opts_exist)
539
+
540
+ expect(res.code).to eql(200)
541
+ expect(res.status).to eql("OK")
542
+
543
+ expect(res.file_exist.is_exist).to be false
544
+ expect(res.file_exist.is_folder).to be false
545
+
546
+ # Check dst after move
547
+ res = @api.get_is_exist(dst, opts_exist)
548
+
549
+ expect(res.code).to eql(200)
550
+ expect(res.status).to eql("OK")
551
+
552
+ expect(res.file_exist.is_exist).to be true
553
+ expect(res.file_exist.is_folder).to be true
554
+
555
+ # Clear test folder
556
+ opts_delete = {storage: nil, recursive: true}
557
+ res = @api.delete_folder(dst, opts_delete)
558
+
559
+ expect(res.code).to eql(200)
560
+ expect(res.status).to eql("OK")
561
+
562
+ # Check after clear
563
+ res = @api.get_is_exist(dst, opts_exist)
564
+
565
+ expect(res.code).to eql(200)
566
+ expect(res.status).to eql("OK")
567
+
568
+ expect(res.file_exist.is_exist).to be false
569
+ expect(res.file_exist.is_folder).to be false
570
+ end
571
+ end
572
+
573
+ # unit tests for get_list_files
574
+ # Get the file listing of a specific folder
575
+ #
576
+ # @param [Hash] opts the optional parameters
577
+ # @option opts [String] :path Start with name of storage e.g. root folder &#39;/&#39;or some folder &#39;/folder1/..&#39;
578
+ # @option opts [String] :storage User&#39;s storage name
579
+ # @return [FileDetailsResponse]
580
+ describe 'get_list_files test' do
581
+ it "should work" do
582
+ opts = {path: '/', storage: nil}
583
+
584
+ res = @api.get_list_files(opts)
585
+
586
+ expect(res.code).to eql(200)
587
+ expect(res.status).to eql("OK")
588
+
589
+ expect(res).to be_an_instance_of AsposeHtml::FileDetailsResponse
590
+ expect(res.code).to be_an_instance_of Integer
591
+ expect(res.status).to be_an_instance_of String
592
+ expect(res.file_details).to be_an_instance_of Array
593
+ expect(res.file_details[0]).to be_an_instance_of AsposeHtml::FileDetail
594
+ end
595
+ end
596
+ end