mirror of
https://github.com/wahyd4/ruby-sdk.git
synced 2026-08-09 04:46:10 +10:00
修正资源管理测试用例,建立固定Bucket(用后不删除),避免631响应码问题。
This commit is contained in:
@@ -11,21 +11,21 @@ module Qiniu
|
||||
describe Storage do
|
||||
|
||||
before :all do
|
||||
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
||||
@bucket = 'RubySDK-Test-Management'
|
||||
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
|
||||
@key2 = @key + rand(100).to_s
|
||||
|
||||
### 尝试创建Bucket
|
||||
code, data = Storage.mkbucket(@bucket)
|
||||
puts [code, data].inspect
|
||||
code.should == 200
|
||||
end
|
||||
|
||||
after :all do
|
||||
code, data = Storage.drop(@bucket)
|
||||
puts [code, data].inspect
|
||||
code.should == 200
|
||||
### 不删除Bucket以备下次使用
|
||||
end
|
||||
|
||||
### 准备数据
|
||||
context ".put_file" do
|
||||
it "should works" do
|
||||
code, data = Storage.put_file(__FILE__, @bucket, @key, 'application/x-ruby', 'customMeta', true)
|
||||
@@ -34,6 +34,7 @@ module Qiniu
|
||||
end
|
||||
end
|
||||
|
||||
### 列举Bucket
|
||||
context ".buckets" do
|
||||
it "should works" do
|
||||
code, data = Storage.buckets
|
||||
@@ -52,7 +53,7 @@ module Qiniu
|
||||
|
||||
context ".get" do
|
||||
it "should works" do
|
||||
code, data = Storage.get(@bucket, @key, "rs_spec.rb", 1)
|
||||
code, data = Storage.get(@bucket, @key, "management_spec.rb", 1)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
end
|
||||
@@ -88,10 +89,6 @@ module Qiniu
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
|
||||
#code2, data2 = Qiniu.stat(@bucket, @key2)
|
||||
#code2.should == 200
|
||||
#puts data2.inspect
|
||||
|
||||
code, data = Storage.delete @bucket, @key2
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
@@ -104,34 +101,12 @@ module Qiniu
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
|
||||
#code2, data2 = Qiniu.stat(@bucket, @key2)
|
||||
#code2.should == 200
|
||||
#puts data2.inspect
|
||||
|
||||
code3, data3 = Storage.batch_move @bucket, @key2, @bucket, @key
|
||||
code3.should == 200
|
||||
puts data3.inspect
|
||||
end
|
||||
end
|
||||
|
||||
=begin
|
||||
context ".publish" do
|
||||
it "should works" do
|
||||
code, data = Qiniu.publish(@domain, @bucket)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
end
|
||||
end
|
||||
|
||||
context ".unpublish" do
|
||||
it "should works" do
|
||||
code, data = Qiniu.unpublish(@domain)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
context ".move" do
|
||||
it "should works" do
|
||||
code, data = Storage.move(@bucket, @key, @bucket, @key2)
|
||||
@@ -154,9 +129,9 @@ module Qiniu
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
|
||||
#code2, data2 = Qiniu.stat(@bucket, @key2)
|
||||
#code2.should == 200
|
||||
#puts data2.inspect
|
||||
code, data = Storage.delete(@bucket, @key2)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
end
|
||||
end
|
||||
|
||||
@@ -168,14 +143,6 @@ module Qiniu
|
||||
end
|
||||
end
|
||||
|
||||
context ".drop" do
|
||||
it "should works" do
|
||||
code, data = Storage.drop(@bucket)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end # module Storage
|
||||
end # module Qiniu
|
||||
|
||||
@@ -10,16 +10,11 @@ module Qiniu
|
||||
describe Misc do
|
||||
|
||||
before :all do
|
||||
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
|
||||
result = Qiniu.mkbucket(@bucket)
|
||||
puts result.inspect
|
||||
result.should_not be_false
|
||||
### 复用RubySDK-Test-Management空间
|
||||
@bucket = 'RubySDK-Test-Management'
|
||||
end
|
||||
|
||||
after :all do
|
||||
result = Qiniu.drop(@bucket)
|
||||
puts result.inspect
|
||||
result.should_not be_false
|
||||
end
|
||||
|
||||
context ".set_protected" do
|
||||
|
||||
Reference in New Issue
Block a user