修正测试用例,建立固定Bucket(用后不删除),避免631响应码问题。

This commit is contained in:
Liang Tao
2014-03-19 14:11:10 +08:00
parent 128e6f0fd7
commit e97dc07ba3
4 changed files with 20 additions and 15 deletions
+6 -6
View File
@@ -11,12 +11,14 @@ module Qiniu
before :all do
@bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s
@key = "image_logo_for_test.png"
### 复用RubySDK-Test-Storage空间
@bucket = 'RubySDK-Test-Storage'
### 尝试创建空间
result = Qiniu.mkbucket(@bucket)
puts result.inspect
result.should be_true
@key = "image_logo_for_test.png"
local_file = File.expand_path('../' + @key, __FILE__)
@@ -53,9 +55,7 @@ module Qiniu
end
after :all do
result = Qiniu.drop(@bucket)
puts result.inspect
result.should_not be_false
### 不删除Bucket以备下次使用
end
context ".info" do
+5 -5
View File
@@ -12,13 +12,13 @@ module Qiniu
before :all do
@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
result = Qiniu.mkbucket(@bucket)
puts result.inspect
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
@key2 = @key + rand(100).to_s
end
after :all do
+4
View File
@@ -12,9 +12,13 @@ module Qiniu
before :all do
### 复用RubySDK-Test-Management空间
@bucket = 'RubySDK-Test-Management'
result = Qiniu.mkbucket(@bucket)
puts result.inspect
end
after :all do
### 不删除Bucket以备下次使用
end
context ".set_protected" do
+5 -4
View File
@@ -11,6 +11,11 @@ module Qiniu
before :all do
@bucket = 'RubySDK-Test-Storage'
### 尝试创建Bucket
result = Qiniu.mkbucket(@bucket)
puts result.inspect
@key = Digest::SHA1.hexdigest((Time.now.to_i+rand(100)).to_s)
@localfile_5m = "5M.txt"
@@ -28,10 +33,6 @@ module Qiniu
@localfile_1m = "1M.txt"
File.open(@localfile_1m, "w"){|f| (1 << 20).times{ f.write(rand(9).to_s) }}
@key_1m = Digest::SHA1.hexdigest(@localfile_1m+Time.now.to_s)
### 尝试创建Bucket
result = Qiniu.mkbucket(@bucket)
puts result.inspect
end
after :all do