Skip to content
Browse files

Specs for request_proxies

  • Loading branch information...
1 parent a5b38c3 commit 2e1106acae8d4ed3acadba3368827ad89d0fbede @bananagi bananagi committed Apr 28, 2011
View
25 spec/oauth/request_proxy/exclude_post_params_from_signature_spec.rb
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-require 'opensocial-wap/oauth/request_proxy/exclude_post_params_from_signature'
-
-describe OpensocialWap::OAuth::RequestProxy::ExcludePostParamsFromSignature do
-
- it "parameters_for_signatureにPOSTパラメータが含まれないこと" do
- uri = 'http://example.com/?opensocial_app_id=877&opensocial_owner_id=23&sample_key=sample_value'
- opts = {
- :method => "POST",
- :params => "a=b&c=d",
- :input => "_method=put&var%5Bkey%5D=123"
- }
- env = ::Rack::MockRequest.env_for(uri, opts)
- request = ::Rack::Request.new(env)
-
- request_proxy = ::OAuth::RequestProxy.proxy(request)
- request_proxy.parameters_for_signature.keys.should include "opensocial_app_id"
- request_proxy.parameters_for_signature.keys.should include "opensocial_owner_id"
- request_proxy.parameters_for_signature.keys.should include "sample_key"
- request_proxy.parameters_for_signature.keys.should_not include "_method"
- request_proxy.parameters_for_signature.keys.should_not include "_var[key]"
- end
-end
View
22 spec/oauth/request_proxy/oauth_rack_request_proxy_for_mixi_spec.rb
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+require 'spec_helper'
+
+describe OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxyForMixi do
+
+ it "signature_base_string が、POSTデータ起源のパラメータを含まないこと" do
+ pending "TODO:値をセット"
+
+ uri = 'http://example.com/?opensocial_app_id=877&opensocial_owner_id=23&sample_key=sample_value'
+ opts = {
+ :method => "POST",
+ :params => "a=b&c=d",
+ :input => "_method=put&var%5Bkey%5D=123"
+ }
+ env = ::Rack::MockRequest.env_for(uri, opts)
+ request = ::Rack::Request.new(env)
+
+ request_proxy = OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxyForMixi.new(request)
+ puts request_proxy.signature_base_string.should == ''
+ end
+
+end
View
23 spec/oauth/request_proxy/oauth_rack_request_proxy_spec.rb
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+require 'spec_helper'
+
+describe OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxy do
+
+ it "signature_base_stringが正しく構築できること" do
+ pending "TODO:値をセット"
+
+ uri = 'http://example.com/?opensocial_app_id=877&opensocial_owner_id=23&sample_key=sample_value'
+ opts = {
+ :method => "POST",
+ :params => "a=b&c=d",
+ :input => "_method=put&var%5Bkey%5D=123"
+ }
+ env = ::Rack::MockRequest.env_for(uri, opts)
+ request = ::Rack::Request.new(env)
+
+ request_proxy = OpensocialWap::OAuth::RequestProxy::OAuthRackRequestProxy.new(request)
+ puts request_proxy.signature_base_string.should == ''
+
+ end
+
+end
View
23 spec/oauth/request_proxy/rack_request_patch_spec.rb
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-require 'spec_helper'
-
-require 'opensocial-wap/oauth/request_proxy/rack_request_patch'
-
-describe OpensocialWap::OAuth::RequestProxy::RackRequestPatch do
-
- it "POSTデータの解析結果が、パッチの内容を反映していること" do
- uri = 'http://example.com/?opensocial_app_id=877&opensocial_owner_id=23&sample_key=sample_value'
- opts = {
- :method => "POST",
- :params => "a=b&c=d",
- :input => "_method=put&var%5Bkey%5D=123"
- }
- env = ::Rack::MockRequest.env_for(uri, opts)
- request = ::Rack::Request.new(env)
- request.POST["var"].should == {"key" => "123"}
-
- request_proxy = ::OAuth::RequestProxy.proxy(request)
- (request_proxy.send :request_params)["_method"].should == "put"
- (request_proxy.send :request_params)["var[key]"].should == "123"
- end
-end

0 comments on commit 2e1106a

Please sign in to comment.
Something went wrong with that request. Please try again.