mirror of
https://github.com/wahyd4/ruby-sdk.git
synced 2026-08-09 04:46:10 +10:00
将测试用例中对Storage.upload_with_token_2的调用更换为Storage.upload_with_put_policy。
This commit is contained in:
@@ -31,13 +31,10 @@ module Qiniu
|
||||
puts "key=#{key}"
|
||||
|
||||
### 上传测试文件
|
||||
upopts = {:scope => @bucket, :expires_in => 3600, :endUser => "why404@gmail.com"}
|
||||
uptoken = Qiniu.generate_upload_token(upopts)
|
||||
|
||||
code, data, raw_headers = Qiniu::Storage.upload_with_token_2(
|
||||
uptoken,
|
||||
__FILE__,
|
||||
key
|
||||
pp = Auth::PutPolicy.new(@bucket, key)
|
||||
code, data, raw_headers = Qiniu::Storage.upload_with_put_policy(
|
||||
pp,
|
||||
__FILE__
|
||||
)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# vim: sw=2 ts=2
|
||||
|
||||
require 'digest/sha1'
|
||||
require 'spec_helper'
|
||||
@@ -29,15 +30,12 @@ module Qiniu
|
||||
end
|
||||
|
||||
### 准备数据
|
||||
context ".upload_with_token_2" do
|
||||
context ".prepare_file" do
|
||||
it "should works" do
|
||||
upopts = {:scope => @bucket, :expires_in => 3600, :endUser => "why404@gmail.com"}
|
||||
uptoken = Qiniu.generate_upload_token(upopts)
|
||||
|
||||
code, data, raw_headers = Qiniu::Storage.upload_with_token_2(
|
||||
uptoken,
|
||||
__FILE__,
|
||||
@key
|
||||
pp = Auth::PutPolicy.new(@bucket, @key)
|
||||
code, data, raw_headers = Qiniu::Storage.upload_with_put_policy(
|
||||
pp,
|
||||
__FILE__
|
||||
)
|
||||
code.should == 200
|
||||
puts data.inspect
|
||||
|
||||
Reference in New Issue
Block a user