From 8bd052e3091e4a707cfaaf1cd6fd14d978c8c5dd Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Wed, 19 Mar 2014 14:35:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E5=BB=BA=E7=AB=8B=E5=9B=BA=E5=AE=9ABucket?= =?UTF-8?q?=EF=BC=88=E7=94=A8=E5=90=8E=E4=B8=8D=E5=88=A0=E9=99=A4=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D631=E5=93=8D=E5=BA=94=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/qiniu/management_spec.rb | 2 +- spec/qiniu/qiniu_spec.rb | 71 ++++++----------------------------- 2 files changed, 12 insertions(+), 61 deletions(-) diff --git a/spec/qiniu/management_spec.rb b/spec/qiniu/management_spec.rb index b780534..6c32671 100755 --- a/spec/qiniu/management_spec.rb +++ b/spec/qiniu/management_spec.rb @@ -53,7 +53,7 @@ module Qiniu context ".get" do it "should works" do - code, data = Storage.get(@bucket, @key, "management_spec.rb", 1) + code, data = Storage.get(@bucket, @key) code.should == 200 puts data.inspect end diff --git a/spec/qiniu/qiniu_spec.rb b/spec/qiniu/qiniu_spec.rb index 0c266b6..1c62d43 100755 --- a/spec/qiniu/qiniu_spec.rb +++ b/spec/qiniu/qiniu_spec.rb @@ -9,19 +9,17 @@ module Qiniu describe Qiniu do before :all do - @bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s + @bucket = 'RubySDK-Test' + @test_image_bucket = @bucket + + ### 尝试创建Bucket + result = Qiniu.mkbucket(@bucket) + puts result.inspect + @key = Digest::SHA1.hexdigest Time.now.to_s @key2 = @key + rand(100).to_s #@domain = @bucket + '.dn.qbox.me' - result = Qiniu.mkbucket(@bucket) - result.should_not be_false - - @test_image_bucket = 'RubySdkTest' + (Time.now.to_i+rand(1000)).to_s - result2 = Qiniu.mkbucket(@test_image_bucket) - puts result2.inspect - result2.should be_true - @test_image_key = 'image_logo_for_test.png' local_file = File.expand_path('./' + @test_image_key, File.dirname(__FILE__)) puts local_file.inspect @@ -32,16 +30,7 @@ module Qiniu end after :all do - #result = Qiniu.unpublish(@domain) - #result.should_not be_false - - result1 = Qiniu.drop(@bucket) - puts result1.inspect - result1.should_not be_false - - result2 = Qiniu.drop(@test_image_bucket) - puts result2.inspect - result2.should_not be_false + ### 不删除Bucket以备下次使用 end context ".put_file" do @@ -180,7 +169,7 @@ module Qiniu context ".get" do it "should works" do - result = Qiniu.get(@bucket, @key, "rs_spec.rb", 10) + result = Qiniu.get(@bucket, @key, "qiniu_spec.rb", 10) result.should_not be_false result.should_not be_empty puts result.inspect @@ -232,24 +221,6 @@ module Qiniu end end -=begin - context ".publish" do - it "should works" do - result = Qiniu.publish(@domain, @bucket) - result.should_not be_false - end - end -=end - -=begin - context ".unpublish" do - it "should works" do - result = Qiniu.unpublish(@domain) - result.should_not be_false - end - end -=end - =begin context ".batch_copy" do it "should works" do @@ -293,8 +264,8 @@ module Qiniu result = Qiniu.copy(@bucket, @key, @bucket, @key2) result.should_not be_false - #result2 = Qiniu.stat(@bucket, @key2) - #result2.should_not be_false + result3 = Qiniu.delete(@bucket, @key2) + result3.should_not be_false end end @@ -305,13 +276,6 @@ module Qiniu end end - context ".drop" do - it "should works" do - result = Qiniu.drop(@bucket) - result.should_not be_false - end - end - context ".image_info" do it "should works" do data = Qiniu.get(@test_image_bucket, @test_image_key) @@ -325,19 +289,6 @@ module Qiniu end end -=begin - context ".image_exif" do - it "should works" do - data = Qiniu.get(@test_image_bucket, @test_image_key) - data.should_not be_false - data.should_not be_empty - puts data.inspect - result = Qiniu.image_exif(data["url"]) - puts result.inspect - end - end -=end - context ".image_mogrify_save_as" do it "should works" do data = Qiniu.get(@test_image_bucket, @test_image_key)