aliyun-sdk 0.7.1 → 0.7.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/aliyun/common/logging.rb +6 -1
- data/lib/aliyun/version.rb +1 -1
- data/spec/aliyun/oss/bucket_spec.rb +123 -1
- data/spec/aliyun/oss/client/bucket_spec.rb +220 -0
- data/spec/aliyun/oss/object_spec.rb +78 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bc5cc4acd9d6e01955fd76f3b15e38d73a352f457c181bb9de469af4f30c4f3
|
4
|
+
data.tar.gz: 2ec82c787847ed16ac7172cec823756f8752700a8366048127487d3257a2af32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4af5842f0231aa8d5fd3c301e70418f895a5b9e5a36e254a184a4715b70389119a78c931e823ca0df039fde1020b32e82d598becf867b6416b39ecdf904635b
|
7
|
+
data.tar.gz: 94edfce3d26df7ee399e62b56e48f22c055df2ab967affd22d40f4145e48f27bdc8ada7a16916464330287569a58eb0cbd17d8c5dbca73ce2fd31b081d96644c
|
data/CHANGELOG.md
CHANGED
@@ -34,8 +34,13 @@ module Aliyun
|
|
34
34
|
|
35
35
|
def self.logger
|
36
36
|
unless @logger
|
37
|
+
@log_file = nil
|
38
|
+
# Environment parameter ALIYUN_OSS_SDK_LOG_PATH used to control whether output log to a file
|
39
|
+
if ENV['ALIYUN_OSS_SDK_LOG_PATH']
|
40
|
+
@log_file ||= DEFAULT_LOG_FILE
|
41
|
+
end
|
37
42
|
@logger = Logger.new(
|
38
|
-
|
43
|
+
@log_file, MAX_NUM_LOG, ROTATE_SIZE)
|
39
44
|
@logger.level = Logger::INFO
|
40
45
|
end
|
41
46
|
@logger
|
data/lib/aliyun/version.rb
CHANGED
@@ -89,7 +89,7 @@ module Aliyun
|
|
89
89
|
if opts.enabled?
|
90
90
|
xml.LoggingEnabled {
|
91
91
|
xml.TargetBucket opts.target_bucket
|
92
|
-
xml.TargetPrefix opts.target_prefix
|
92
|
+
xml.TargetPrefix opts.target_prefix if opts.target_prefix
|
93
93
|
}
|
94
94
|
end
|
95
95
|
}
|
@@ -392,6 +392,19 @@ module Aliyun
|
|
392
392
|
.with(:query => query, :body => mock_logging(logging_opts))
|
393
393
|
end
|
394
394
|
|
395
|
+
it "should enable logging without target prefix" do
|
396
|
+
query = {'logging' => nil}
|
397
|
+
stub_request(:put, request_path).with(:query => query)
|
398
|
+
|
399
|
+
logging_opts = BucketLogging.new(
|
400
|
+
:enable => true,
|
401
|
+
:target_bucket => 'target-bucket')
|
402
|
+
@protocol.put_bucket_logging(@bucket, logging_opts)
|
403
|
+
|
404
|
+
expect(WebMock).to have_requested(:put, request_path)
|
405
|
+
.with(:query => query, :body => mock_logging(logging_opts))
|
406
|
+
end
|
407
|
+
|
395
408
|
it "should disable logging" do
|
396
409
|
query = {'logging' => nil}
|
397
410
|
stub_request(:put, request_path).with(:query => query)
|
@@ -420,6 +433,23 @@ module Aliyun
|
|
420
433
|
expect(logging.to_s).to eq(logging_opts.to_s)
|
421
434
|
end
|
422
435
|
|
436
|
+
it "should get logging without target-bucket" do
|
437
|
+
query = {'logging' => nil}
|
438
|
+
logging_opts = BucketLogging.new(
|
439
|
+
:enable => false,
|
440
|
+
:target_bucket => nil, :target_prefix => nil)
|
441
|
+
|
442
|
+
stub_request(:get, request_path)
|
443
|
+
.with(:query => query)
|
444
|
+
.to_return(:body => mock_logging(logging_opts))
|
445
|
+
|
446
|
+
logging = @protocol.get_bucket_logging(@bucket)
|
447
|
+
|
448
|
+
expect(WebMock).to have_requested(:get, request_path)
|
449
|
+
.with(:query => query, :body => nil)
|
450
|
+
expect(logging.to_s).to eq(logging_opts.to_s)
|
451
|
+
end
|
452
|
+
|
423
453
|
it "should delete logging" do
|
424
454
|
query = {'logging' => nil}
|
425
455
|
stub_request(:delete, request_path).with(:query => query)
|
@@ -430,6 +460,18 @@ module Aliyun
|
|
430
460
|
.with(:query => query, :body => nil)
|
431
461
|
end
|
432
462
|
|
463
|
+
it "should raise Exception when enable logging" do
|
464
|
+
query = {'logging' => nil}
|
465
|
+
stub_request(:put, request_path).with(:query => query)
|
466
|
+
|
467
|
+
logging_opts = BucketLogging.new(
|
468
|
+
:enable => true,
|
469
|
+
:target_bucket => nil, :target_prefix => nil)
|
470
|
+
expect {
|
471
|
+
@protocol.put_bucket_logging(@bucket, logging_opts)
|
472
|
+
}.to raise_error(ClientError)
|
473
|
+
end
|
474
|
+
|
433
475
|
it "should update website" do
|
434
476
|
query = {'website' => nil}
|
435
477
|
stub_request(:put, request_path).with(:query => query)
|
@@ -442,6 +484,18 @@ module Aliyun
|
|
442
484
|
.with(:query => query, :body => mock_website(website_opts))
|
443
485
|
end
|
444
486
|
|
487
|
+
it "should update website with index only" do
|
488
|
+
query = {'website' => nil}
|
489
|
+
stub_request(:put, request_path).with(:query => query)
|
490
|
+
|
491
|
+
website_opts = BucketWebsite.new(
|
492
|
+
:enable => true, :index => 'index.html', :error => nil)
|
493
|
+
@protocol.put_bucket_website(@bucket, website_opts)
|
494
|
+
|
495
|
+
expect(WebMock).to have_requested(:put, request_path)
|
496
|
+
.with(:query => query, :body => mock_website(website_opts))
|
497
|
+
end
|
498
|
+
|
445
499
|
it "should get website" do
|
446
500
|
query = {'website' => nil}
|
447
501
|
website_opts = BucketWebsite.new(
|
@@ -468,6 +522,18 @@ module Aliyun
|
|
468
522
|
.with(:query => query, :body => nil)
|
469
523
|
end
|
470
524
|
|
525
|
+
it "should raise Exception when update website" do
|
526
|
+
query = {'website' => nil}
|
527
|
+
stub_request(:put, request_path).with(:query => query)
|
528
|
+
|
529
|
+
website_opts = BucketWebsite.new(
|
530
|
+
:enable => true, :index => nil)
|
531
|
+
|
532
|
+
expect {
|
533
|
+
@protocol.put_bucket_website(@bucket, website_opts)
|
534
|
+
}.to raise_error(ClientError)
|
535
|
+
end
|
536
|
+
|
471
537
|
it "should update referer" do
|
472
538
|
query = {'referer' => nil}
|
473
539
|
stub_request(:put, request_path).with(:query => query)
|
@@ -541,6 +607,44 @@ module Aliyun
|
|
541
607
|
.with(:query => query, :body => nil)
|
542
608
|
end
|
543
609
|
|
610
|
+
it "should raise Exception when update lifecycle " do
|
611
|
+
query = {'lifecycle' => nil}
|
612
|
+
stub_request(:put, request_path).with(:query => query)
|
613
|
+
|
614
|
+
rules = (1..5).map do |i|
|
615
|
+
LifeCycleRule.new(
|
616
|
+
:id => i, :enable => i % 2 == 0, :prefix => "foo#{i}",
|
617
|
+
:expiry => 'invalid')
|
618
|
+
end
|
619
|
+
|
620
|
+
expect {
|
621
|
+
@protocol.put_bucket_lifecycle(@bucket, rules)
|
622
|
+
}.to raise_error(ClientError)
|
623
|
+
end
|
624
|
+
|
625
|
+
it "should raise Exception when get lifecycle " do
|
626
|
+
query = {'lifecycle' => nil}
|
627
|
+
body = '<LifecycleConfiguration>
|
628
|
+
<Rule>
|
629
|
+
<ID>delete after one day</ID>
|
630
|
+
<Prefix>logs/</Prefix>
|
631
|
+
<Status>Enabled</Status>
|
632
|
+
<Expiration>
|
633
|
+
<Days>1</Days>
|
634
|
+
<Date>2017-01-01T00:00:00.000Z</Date>
|
635
|
+
</Expiration>
|
636
|
+
</Rule>
|
637
|
+
</LifecycleConfiguration>'
|
638
|
+
|
639
|
+
stub_request(:get, request_path)
|
640
|
+
.with(:query => query)
|
641
|
+
.to_return(:body => body)
|
642
|
+
|
643
|
+
expect {
|
644
|
+
rules = @protocol.get_bucket_lifecycle(@bucket)
|
645
|
+
}.to raise_error(ClientError)
|
646
|
+
end
|
647
|
+
|
544
648
|
it "should set cors" do
|
545
649
|
query = {'cors' => nil}
|
546
650
|
stub_request(:put, request_path).with(:query => query)
|
@@ -558,6 +662,24 @@ module Aliyun
|
|
558
662
|
.with(:query => query, :body => mock_cors(rules))
|
559
663
|
end
|
560
664
|
|
665
|
+
it "should set cors with MaxAgeSeconds " do
|
666
|
+
query = {'cors' => nil}
|
667
|
+
stub_request(:put, request_path).with(:query => query)
|
668
|
+
|
669
|
+
rules = (1..5).map do |i|
|
670
|
+
CORSRule.new(
|
671
|
+
:allowed_origins => (1..3).map {|x| "origin-#{x}"},
|
672
|
+
:allowed_methods => ['PUT', 'GET'],
|
673
|
+
:allowed_headers => (1..3).map {|x| "header-#{x}"},
|
674
|
+
:expose_headers => (1..3).map {|x| "header-#{x}"},
|
675
|
+
:max_age_seconds => 5)
|
676
|
+
end
|
677
|
+
@protocol.set_bucket_cors(@bucket, rules)
|
678
|
+
|
679
|
+
expect(WebMock).to have_requested(:put, request_path)
|
680
|
+
.with(:query => query, :body => mock_cors(rules))
|
681
|
+
end
|
682
|
+
|
561
683
|
it "should get cors" do
|
562
684
|
query = {'cors' => nil}
|
563
685
|
return_rules = (1..5).map do |i|
|
@@ -156,6 +156,226 @@ module Aliyun
|
|
156
156
|
.with(:query => query, :body => nil)
|
157
157
|
end
|
158
158
|
|
159
|
+
it "should set logging setting" do
|
160
|
+
query = {'logging' => nil}
|
161
|
+
|
162
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
163
|
+
xml.BucketLoggingStatus {
|
164
|
+
xml.LoggingEnabled {
|
165
|
+
xml.TargetBucket 'target-bucket'
|
166
|
+
}
|
167
|
+
}
|
168
|
+
end.to_xml
|
169
|
+
|
170
|
+
stub_request(:put, bucket_url).with(:query => query)
|
171
|
+
|
172
|
+
@bucket.logging = BucketLogging.new(:enable => true, :target_bucket => 'target-bucket')
|
173
|
+
|
174
|
+
expect(WebMock).to have_requested(:put, bucket_url)
|
175
|
+
.with(:query => query, :body => body)
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should get logging setting" do
|
179
|
+
query = {'logging' => nil}
|
180
|
+
|
181
|
+
retbody = Nokogiri::XML::Builder.new do |xml|
|
182
|
+
xml.BucketLoggingStatus {
|
183
|
+
xml.LoggingEnabled {
|
184
|
+
xml.TargetBucket 'target-bucket'
|
185
|
+
xml.TargetPrefix 'target-prefix'
|
186
|
+
}
|
187
|
+
}
|
188
|
+
end.to_xml
|
189
|
+
|
190
|
+
stub_request(:get, bucket_url)
|
191
|
+
.with(:query => query)
|
192
|
+
.to_return(status: 200, :body => retbody)
|
193
|
+
|
194
|
+
logging = @bucket.logging
|
195
|
+
|
196
|
+
expect(WebMock).to have_requested(:get, bucket_url)
|
197
|
+
.with(:query => query, :body => nil)
|
198
|
+
expect(logging.enable).to eq(true)
|
199
|
+
expect(logging.target_bucket).to eq('target-bucket')
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should set webseit" do
|
204
|
+
query = {'website' => nil}
|
205
|
+
|
206
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
207
|
+
xml.WebsiteConfiguration {
|
208
|
+
xml.IndexDocument {
|
209
|
+
xml.Suffix 'index.html'
|
210
|
+
}
|
211
|
+
}
|
212
|
+
end.to_xml
|
213
|
+
|
214
|
+
stub_request(:put, bucket_url)
|
215
|
+
.with(:query => query)
|
216
|
+
.to_return(status: 200, :body => nil)
|
217
|
+
|
218
|
+
@bucket.website = BucketWebsite.new(:enable => true, :index => 'index.html')
|
219
|
+
|
220
|
+
expect(WebMock).to have_requested(:put, bucket_url)
|
221
|
+
.with(:query => query, :body => body)
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should delete webseit" do
|
225
|
+
query = {'website' => nil}
|
226
|
+
|
227
|
+
stub_request(:delete, bucket_url)
|
228
|
+
.with(:query => query)
|
229
|
+
.to_return(status: 204, :body => nil)
|
230
|
+
|
231
|
+
@bucket.website = BucketWebsite.new(:enable => false)
|
232
|
+
|
233
|
+
expect(WebMock).to have_requested(:delete, bucket_url)
|
234
|
+
.with(:query => query, :body => nil)
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should get webseit" do
|
238
|
+
query = {'website' => nil}
|
239
|
+
|
240
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
241
|
+
xml.WebsiteConfiguration {
|
242
|
+
xml.IndexDocument {
|
243
|
+
xml.Suffix 'index.html'
|
244
|
+
}
|
245
|
+
xml.ErrorDocument {
|
246
|
+
xml.Key 'error.html'
|
247
|
+
}
|
248
|
+
}
|
249
|
+
end.to_xml
|
250
|
+
|
251
|
+
stub_request(:get, bucket_url)
|
252
|
+
.with(:query => query)
|
253
|
+
.to_return(status: 200, :body => body)
|
254
|
+
|
255
|
+
website = @bucket.website
|
256
|
+
|
257
|
+
expect(WebMock).to have_requested(:get, bucket_url)
|
258
|
+
.with(:query => query, :body => nil)
|
259
|
+
|
260
|
+
expect(website.enable).to eq(true)
|
261
|
+
expect(website.index).to eq('index.html')
|
262
|
+
expect(website.error).to eq('error.html')
|
263
|
+
end
|
264
|
+
|
265
|
+
it "should set referer" do
|
266
|
+
query = {'referer' => nil}
|
267
|
+
|
268
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
269
|
+
xml.RefererConfiguration {
|
270
|
+
xml.AllowEmptyReferer 'true'
|
271
|
+
xml.RefererList {
|
272
|
+
xml.Referer 'http://www.aliyun.com'
|
273
|
+
}
|
274
|
+
}
|
275
|
+
end.to_xml
|
276
|
+
|
277
|
+
stub_request(:put, bucket_url)
|
278
|
+
.with(:query => query)
|
279
|
+
.to_return(status: 200, :body => nil)
|
280
|
+
|
281
|
+
@bucket.referer = BucketReferer.new(:allow_empty => true, :whitelist => ['http://www.aliyun.com'])
|
282
|
+
|
283
|
+
expect(WebMock).to have_requested(:put, bucket_url)
|
284
|
+
.with(:query => query, :body => body)
|
285
|
+
end
|
286
|
+
|
287
|
+
it "should get referer" do
|
288
|
+
query = {'referer' => nil}
|
289
|
+
|
290
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
291
|
+
xml.RefererConfiguration {
|
292
|
+
xml.AllowEmptyReferer 'true'
|
293
|
+
xml.RefererList {
|
294
|
+
xml.Referer 'http://www.aliyun.com'
|
295
|
+
}
|
296
|
+
}
|
297
|
+
end.to_xml
|
298
|
+
|
299
|
+
stub_request(:get, bucket_url)
|
300
|
+
.with(:query => query)
|
301
|
+
.to_return(status: 200, :body => body)
|
302
|
+
|
303
|
+
referer = @bucket.referer
|
304
|
+
|
305
|
+
expect(WebMock).to have_requested(:get, bucket_url)
|
306
|
+
.with(:query => query, :body => nil)
|
307
|
+
|
308
|
+
expect(referer.allow_empty).to eq(true)
|
309
|
+
expect(referer.whitelist).to eq(['http://www.aliyun.com'])
|
310
|
+
end
|
311
|
+
|
312
|
+
it "should set cors" do
|
313
|
+
query = {'cors' => nil}
|
314
|
+
|
315
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
316
|
+
xml.CORSConfiguration {
|
317
|
+
xml.CORSRule {
|
318
|
+
xml.AllowedOrigin '*'
|
319
|
+
xml.AllowedMethod 'PUT'
|
320
|
+
xml.AllowedHeader 'Authorization'
|
321
|
+
}
|
322
|
+
}
|
323
|
+
end.to_xml
|
324
|
+
|
325
|
+
stub_request(:put, bucket_url)
|
326
|
+
.with(:query => query)
|
327
|
+
.to_return(status: 200, :body => nil)
|
328
|
+
|
329
|
+
rules = [
|
330
|
+
CORSRule.new(
|
331
|
+
:allowed_origins => ['*'],
|
332
|
+
:allowed_methods => ['PUT'],
|
333
|
+
:allowed_headers => ['Authorization'],
|
334
|
+
:expose_headers =>[])
|
335
|
+
]
|
336
|
+
|
337
|
+
@bucket.cors = rules
|
338
|
+
|
339
|
+
expect(WebMock).to have_requested(:put, bucket_url)
|
340
|
+
.with(:query => query, :body => body)
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should delete cors" do
|
344
|
+
query = {'cors' => nil}
|
345
|
+
|
346
|
+
stub_request(:delete, bucket_url)
|
347
|
+
.with(:query => query)
|
348
|
+
.to_return(status: 204, :body => nil)
|
349
|
+
|
350
|
+
@bucket.cors = []
|
351
|
+
|
352
|
+
expect(WebMock).to have_requested(:delete, bucket_url)
|
353
|
+
.with(:query => query, :body => nil)
|
354
|
+
end
|
355
|
+
|
356
|
+
it "should get cors" do
|
357
|
+
query = {'cors' => nil}
|
358
|
+
|
359
|
+
body = Nokogiri::XML::Builder.new do |xml|
|
360
|
+
xml.CORSConfiguration {
|
361
|
+
xml.CORSRule {
|
362
|
+
xml.AllowedOrigin '*'
|
363
|
+
xml.AllowedMethod 'PUT'
|
364
|
+
xml.AllowedHeader 'Authorization'
|
365
|
+
}
|
366
|
+
}
|
367
|
+
end.to_xml
|
368
|
+
|
369
|
+
stub_request(:get, bucket_url)
|
370
|
+
.with(:query => query)
|
371
|
+
.to_return(status: 200, :body => body)
|
372
|
+
|
373
|
+
cors = @bucket.cors
|
374
|
+
|
375
|
+
expect(WebMock).to have_requested(:get, bucket_url)
|
376
|
+
.with(:query => query, :body => nil)
|
377
|
+
end
|
378
|
+
|
159
379
|
it "should get bucket url" do
|
160
380
|
expect(@bucket.bucket_url)
|
161
381
|
.to eq('http://rubysdk-bucket.oss-cn-hangzhou.aliyuncs.com/')
|
@@ -611,6 +611,15 @@ module Aliyun
|
|
611
611
|
})
|
612
612
|
end
|
613
613
|
|
614
|
+
it "should raise Exception on error when setting invalid range" do
|
615
|
+
object_name = 'ruby'
|
616
|
+
url = get_request_path(object_name)
|
617
|
+
stub_request(:get, url)
|
618
|
+
expect {
|
619
|
+
@protocol.get_object(@bucket, object_name, {:range => [0, 10, 5]}) {}
|
620
|
+
}.to raise_error(ClientError)
|
621
|
+
end
|
622
|
+
|
614
623
|
it "should match modify time and etag" do
|
615
624
|
object_name = 'ruby'
|
616
625
|
url = get_request_path(object_name)
|
@@ -662,6 +671,22 @@ module Aliyun
|
|
662
671
|
.with(:body => nil, :query => query)
|
663
672
|
end
|
664
673
|
|
674
|
+
it "should get object with headers" do
|
675
|
+
object_name = 'ruby'
|
676
|
+
url = get_request_path(object_name)
|
677
|
+
headers = {
|
678
|
+
'Range' => 'bytes=0-9'
|
679
|
+
}
|
680
|
+
stub_request(:get, url)
|
681
|
+
|
682
|
+
@protocol.get_object(@bucket, object_name, {:headers => headers}) {}
|
683
|
+
|
684
|
+
expect(WebMock).to have_requested(:get, url)
|
685
|
+
.with(:body => nil, :query => {},
|
686
|
+
:headers => {
|
687
|
+
'Range' => 'bytes=0-9'
|
688
|
+
})
|
689
|
+
end
|
665
690
|
|
666
691
|
it "should raise crc exception on error" do
|
667
692
|
object_name = 'ruby'
|
@@ -821,7 +846,7 @@ module Aliyun
|
|
821
846
|
|
822
847
|
it "should batch delete objects" do
|
823
848
|
url = get_request_path
|
824
|
-
query = {'delete' => nil
|
849
|
+
query = {'delete' => nil}
|
825
850
|
|
826
851
|
object_names = (1..5).map do |i|
|
827
852
|
"object-#{i}"
|
@@ -831,7 +856,7 @@ module Aliyun
|
|
831
856
|
.with(:query => query)
|
832
857
|
.to_return(:body => mock_delete_result(object_names))
|
833
858
|
|
834
|
-
opts = {:quiet => false
|
859
|
+
opts = {:quiet => false}
|
835
860
|
deleted = @protocol.batch_delete_objects(@bucket, object_names, opts)
|
836
861
|
|
837
862
|
expect(WebMock).to have_requested(:post, url)
|
@@ -861,6 +886,57 @@ module Aliyun
|
|
861
886
|
.with(:query => query, :body => mock_delete(object_names, opts))
|
862
887
|
expect(deleted).to match_array(object_names)
|
863
888
|
end
|
889
|
+
|
890
|
+
it "should batch delete objects in quiet mode" do
|
891
|
+
url = get_request_path
|
892
|
+
query = {'delete' => nil}
|
893
|
+
|
894
|
+
object_names = (1..5).map do |i|
|
895
|
+
"object-#{i}"
|
896
|
+
end
|
897
|
+
|
898
|
+
stub_request(:post, url)
|
899
|
+
.with(:query => query)
|
900
|
+
.to_return(:body => "")
|
901
|
+
|
902
|
+
opts = {:quiet => true}
|
903
|
+
deleted = @protocol.batch_delete_objects(@bucket, object_names, opts)
|
904
|
+
|
905
|
+
expect(WebMock).to have_requested(:post, url)
|
906
|
+
.with(:query => query, :body => mock_delete(object_names, opts))
|
907
|
+
expect(deleted).to match_array([])
|
908
|
+
end
|
909
|
+
|
910
|
+
it "should rasie Exception wiht invalid responsed body" do
|
911
|
+
url = get_request_path
|
912
|
+
query = {'delete' => nil}
|
913
|
+
body = '<DeleteResult>
|
914
|
+
<EncodingType>invaid<EncodingType>
|
915
|
+
<Deleted>
|
916
|
+
<Key>multipart.data</Key>
|
917
|
+
</Deleted>
|
918
|
+
<Deleted>
|
919
|
+
<Key>test.jpg</Key>
|
920
|
+
</Deleted>
|
921
|
+
<Deleted>
|
922
|
+
<Key>demo.jpg</Key>
|
923
|
+
</Deleted>
|
924
|
+
</DeleteResult>'
|
925
|
+
|
926
|
+
object_names = (1..5).map do |i|
|
927
|
+
"object-#{i}"
|
928
|
+
end
|
929
|
+
|
930
|
+
stub_request(:post, url)
|
931
|
+
.with(:query => query)
|
932
|
+
.to_return(:body => body)
|
933
|
+
|
934
|
+
opts = {:quiet => false}
|
935
|
+
expect {
|
936
|
+
deleted = @protocol.batch_delete_objects(@bucket, object_names, opts)
|
937
|
+
}.to raise_error(ClientError)
|
938
|
+
|
939
|
+
end
|
864
940
|
end # delete object
|
865
941
|
|
866
942
|
context "acl" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aliyun-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tianlong Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: lib/aliyun
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|