From 8e86a920802939c0d1871dcc7a72e29485bac486 Mon Sep 17 00:00:00 2001 From: 404 Date: Thu, 2 Aug 2012 13:59:02 +0800 Subject: [PATCH] updated watermark tests --- spec/qiniu/rs/eu_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec/qiniu/rs/eu_spec.rb b/spec/qiniu/rs/eu_spec.rb index e4a7322..8c6f03f 100755 --- a/spec/qiniu/rs/eu_spec.rb +++ b/spec/qiniu/rs/eu_spec.rb @@ -1,6 +1,8 @@ # -*- encoding: utf-8 -*- require 'spec_helper' +require 'qiniu/rs/io' +require 'qiniu/rs/pub' require 'qiniu/rs/eu' module Qiniu @@ -9,8 +11,31 @@ module Qiniu before :all do @customer_id = "awhy.xu@gmail.com" + @bucket = "wm_test_bucket" + @key = "image_logo_for_test.png" + + local_file = File.expand_path('../' + @key, __FILE__) + upopts = {:scope => @bucket, :expires_in => 3600, :customer => @customer_id} + uptoken = Qiniu::RS.generate_upload_token(upopts) + + code, data = Qiniu::RS::IO.upload_with_token(uptoken, local_file, @bucket, @key, nil, nil, nil, true) + code.should == 200 + puts data.inspect + + code2, data2 = Qiniu::RS::Pub.set_separator(@bucket, "-") + code2.should == 200 + puts data2.inspect + + code3, data3 = Qiniu::RS::Pub.set_style(@bucket, "small.jpg", "imageView/1/w/120/h/120/q/85/format/jpg/watermark/1") + code3.should == 200 + puts data3.inspect end + #after :all do + # result = Qiniu::RS.drop(@bucket) + # result.should_not be_false + #end + context ".set_watermark" do it "should works" do options = {