oauth 0.5.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oauth might be problematic. Click here for more details.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +13 -2
  3. data/bin/oauth +8 -2
  4. data/lib/oauth.rb +2 -2
  5. data/lib/oauth/cli.rb +37 -359
  6. data/lib/oauth/cli/authorize_command.rb +71 -0
  7. data/lib/oauth/cli/base_command.rb +208 -0
  8. data/lib/oauth/cli/help_command.rb +22 -0
  9. data/lib/oauth/cli/query_command.rb +25 -0
  10. data/lib/oauth/cli/sign_command.rb +81 -0
  11. data/lib/oauth/cli/version_command.rb +7 -0
  12. data/lib/oauth/client/action_controller_request.rb +1 -1
  13. data/lib/oauth/client/em_http.rb +0 -1
  14. data/lib/oauth/client/net_http.rb +0 -1
  15. data/lib/oauth/consumer.rb +26 -3
  16. data/lib/oauth/helper.rb +10 -6
  17. data/lib/oauth/request_proxy/action_controller_request.rb +2 -2
  18. data/lib/oauth/request_proxy/action_dispatch_request.rb +7 -0
  19. data/lib/oauth/request_proxy/base.rb +6 -2
  20. data/lib/oauth/tokens/request_token.rb +4 -4
  21. data/lib/oauth/version.rb +1 -1
  22. metadata +82 -90
  23. data/lib/oauth/core_ext.rb +0 -31
  24. data/test/cases/oauth_case.rb +0 -19
  25. data/test/cases/spec/1_0-final/test_construct_request_url.rb +0 -62
  26. data/test/cases/spec/1_0-final/test_normalize_request_parameters.rb +0 -88
  27. data/test/cases/spec/1_0-final/test_parameter_encodings.rb +0 -86
  28. data/test/cases/spec/1_0-final/test_signature_base_strings.rb +0 -77
  29. data/test/integration/consumer_test.rb +0 -307
  30. data/test/test_access_token.rb +0 -26
  31. data/test/test_action_controller_request_proxy.rb +0 -157
  32. data/test/test_consumer.rb +0 -226
  33. data/test/test_curb_request_proxy.rb +0 -77
  34. data/test/test_em_http_client.rb +0 -80
  35. data/test/test_em_http_request_proxy.rb +0 -115
  36. data/test/test_helper.rb +0 -33
  37. data/test/test_hmac_sha1.rb +0 -20
  38. data/test/test_net_http_client.rb +0 -298
  39. data/test/test_net_http_request_proxy.rb +0 -72
  40. data/test/test_oauth_helper.rb +0 -94
  41. data/test/test_rack_request_proxy.rb +0 -40
  42. data/test/test_request_token.rb +0 -56
  43. data/test/test_rest_client_request_proxy.rb +0 -81
  44. data/test/test_rsa_sha1.rb +0 -59
  45. data/test/test_server.rb +0 -41
  46. data/test/test_signature.rb +0 -15
  47. data/test/test_signature_base.rb +0 -32
  48. data/test/test_signature_hmac_sha1.rb +0 -40
  49. data/test/test_signature_plain_text.rb +0 -31
  50. data/test/test_token.rb +0 -14
  51. data/test/test_typhoeus_request_proxy.rb +0 -101
@@ -1,72 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
-
3
- class NetHTTPRequestProxyTest < Minitest::Test
4
-
5
- def test_that_proxy_simple_get_request_works
6
- request = Net::HTTP::Get.new('/test?key=value')
7
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value'})
8
-
9
- expected_parameters = {'key' => ['value']}
10
- assert_equal expected_parameters, request_proxy.parameters_for_signature
11
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
12
- assert_equal 'GET', request_proxy.method
13
- end
14
-
15
- def test_that_proxy_simple_post_request_works_with_arguments
16
- request = Net::HTTP::Post.new('/test')
17
- params = {'key' => 'value'}
18
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test', :parameters => params})
19
-
20
- expected_parameters = {'key' => ['value']}
21
- assert_equal expected_parameters, request_proxy.parameters_for_signature
22
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
23
- assert_equal 'POST', request_proxy.method
24
- end
25
-
26
- def test_that_proxy_simple_post_request_works_with_form_data
27
- request = Net::HTTP::Post.new('/test')
28
- params = {'key' => 'value'}
29
- request.set_form_data(params)
30
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test'})
31
-
32
- expected_parameters = {'key' => ['value']}
33
- assert_equal expected_parameters, request_proxy.parameters_for_signature
34
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
35
- assert_equal 'POST', request_proxy.method
36
- end
37
-
38
- def test_that_proxy_simple_put_request_works_with_argugments
39
- request = Net::HTTP::Put.new('/test')
40
- params = {'key' => 'value'}
41
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test', :parameters => params})
42
-
43
- expected_parameters = {'key' => ['value']}
44
- assert_equal expected_parameters, request_proxy.parameters_for_signature
45
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
46
- assert_equal 'PUT', request_proxy.method
47
- end
48
-
49
- def test_that_proxy_simple_put_request_works_with_form_data
50
- request = Net::HTTP::Put.new('/test')
51
- params = {'key' => 'value'}
52
- request.set_form_data(params)
53
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test'})
54
-
55
- expected_parameters = {'key' => ['value']}
56
- assert_equal expected_parameters, request_proxy.parameters_for_signature
57
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
58
- assert_equal 'PUT', request_proxy.method
59
- end
60
-
61
- def test_that_proxy_post_request_uses_post_parameters
62
- request = Net::HTTP::Post.new('/test?key=value')
63
- request.set_form_data({'key2' => 'value2'})
64
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value', :parameters => {'key3' => 'value3'}})
65
-
66
- expected_parameters = {'key' => ['value'], 'key2' => ['value2'], 'key3' => ['value3']}
67
- assert_equal expected_parameters, request_proxy.parameters_for_signature
68
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
69
- assert_equal 'POST', request_proxy.method
70
- end
71
-
72
- end
@@ -1,94 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
-
3
- class TestOAuthHelper < Minitest::Test
4
-
5
- def test_parse_valid_header
6
- header = 'OAuth ' \
7
- 'realm="http://example.com/method", ' \
8
- 'oauth_consumer_key="vince_clortho", ' \
9
- 'oauth_token="token_value", ' \
10
- 'oauth_signature_method="HMAC-SHA1", ' \
11
- 'oauth_signature="signature_here", ' \
12
- 'oauth_timestamp="1240004133", oauth_nonce="nonce", ' \
13
- 'oauth_version="1.0" '
14
-
15
- params = OAuth::Helper.parse_header(header)
16
-
17
- assert_equal "http://example.com/method", params['realm']
18
- assert_equal "vince_clortho", params['oauth_consumer_key']
19
- assert_equal "token_value", params['oauth_token']
20
- assert_equal "HMAC-SHA1", params['oauth_signature_method']
21
- assert_equal "signature_here", params['oauth_signature']
22
- assert_equal "1240004133", params['oauth_timestamp']
23
- assert_equal "nonce", params['oauth_nonce']
24
- assert_equal "1.0", params['oauth_version']
25
- end
26
-
27
- def test_parse_header_ill_formed
28
- header = "OAuth garbage"
29
-
30
- assert_raises OAuth::Problem do
31
- OAuth::Helper.parse_header(header)
32
- end
33
- end
34
-
35
- def test_parse_header_contains_equals
36
- header = 'OAuth ' \
37
- 'realm="http://example.com/method", ' \
38
- 'oauth_consumer_key="vince_clortho", ' \
39
- 'oauth_token="token_value", ' \
40
- 'oauth_signature_method="HMAC-SHA1", ' \
41
- 'oauth_signature="signature_here_with_=", ' \
42
- 'oauth_timestamp="1240004133", oauth_nonce="nonce", ' \
43
- 'oauth_version="1.0" '
44
-
45
- assert_raises OAuth::Problem do
46
- OAuth::Helper.parse_header(header)
47
- end
48
- end
49
-
50
- def test_parse_valid_header_with_and_signs
51
- header = 'OAuth ' \
52
- 'realm="http://example.com/method"&' \
53
- 'oauth_consumer_key="vince_clortho"&' \
54
- 'oauth_token="token_value"&' \
55
- 'oauth_signature_method="HMAC-SHA1"&' \
56
- 'oauth_signature="signature_here"&' \
57
- 'oauth_timestamp="1240004133"&oauth_nonce="nonce"&' \
58
- 'oauth_version="1.0"'
59
-
60
- params = OAuth::Helper.parse_header(header)
61
-
62
- assert_equal "http://example.com/method", params['realm']
63
- assert_equal "vince_clortho", params['oauth_consumer_key']
64
- assert_equal "token_value", params['oauth_token']
65
- assert_equal "HMAC-SHA1", params['oauth_signature_method']
66
- assert_equal "signature_here", params['oauth_signature']
67
- assert_equal "1240004133", params['oauth_timestamp']
68
- assert_equal "nonce", params['oauth_nonce']
69
- assert_equal "1.0", params['oauth_version']
70
- end
71
-
72
- def test_normalize
73
- params = {
74
- 'oauth_nonce' => 'nonce',
75
- 'weight' => { :value => "65" },
76
- 'oauth_signature_method' => 'HMAC-SHA1',
77
- 'oauth_timestamp' => "1240004133",
78
- 'oauth_consumer_key' => 'vince_clortho',
79
- 'oauth_token' => 'token_value',
80
- 'oauth_version' => "1.0"
81
- }
82
- assert_equal("oauth_consumer_key=vince_clortho&oauth_nonce=nonce&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1240004133&oauth_token=token_value&oauth_version=1.0&weight%5Bvalue%5D=65", OAuth::Helper.normalize(params))
83
- end
84
-
85
- def test_normalize_nested_query
86
- assert_equal([], OAuth::Helper.normalize_nested_query({}))
87
- assert_equal(["foo=bar"], OAuth::Helper.normalize_nested_query({:foo => 'bar'}))
88
- assert_equal(["prefix%5Bfoo%5D=bar"], OAuth::Helper.normalize_nested_query({:foo => 'bar'}, 'prefix'))
89
- assert_equal(["prefix%5Buser%5D%5Bage%5D=12",
90
- "prefix%5Buser%5D%5Bdate%5D=2011-10-05",
91
- "prefix%5Buser%5D%5Btwitter_id%5D=123"], OAuth::Helper.normalize_nested_query({:user => {:twitter_id => 123, :date => '2011-10-05', :age => 12}}, 'prefix'))
92
- end
93
-
94
- end
@@ -1,40 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
- require 'oauth/request_proxy/rack_request'
3
- require 'rack/request'
4
- require 'rack/mock'
5
-
6
- class RackRequestProxyTest < Minitest::Test
7
-
8
- def test_that_proxy_simple_get_request_works
9
- request = Rack::Request.new(Rack::MockRequest.env_for('http://example.com/test?key=value'))
10
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value'})
11
-
12
- expected_parameters = {'key' => 'value'}
13
- assert_equal expected_parameters, request_proxy.parameters
14
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
15
- assert_equal 'GET', request_proxy.method
16
- end
17
-
18
- def test_that_proxy_simple_post_request_works
19
- request = Rack::Request.new(Rack::MockRequest.env_for('http://example.com/test', :method => 'POST'))
20
- params = {'key' => 'value'}
21
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test', :parameters => params})
22
-
23
- expected_parameters = {'key' => 'value'}
24
- assert_equal expected_parameters, request_proxy.parameters
25
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
26
- assert_equal 'POST', request_proxy.method
27
- end
28
-
29
- def test_that_proxy_post_and_get_request_works
30
- request = Rack::Request.new(Rack::MockRequest.env_for('http://example.com/test?key=value', :method => 'POST', :input => 'key2=value2'))
31
- params = {'key2' => 'value2'}
32
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value', :parameters => params})
33
-
34
- expected_parameters = {'key' => 'value', 'key2' => 'value2'}
35
- assert_equal expected_parameters, request_proxy.parameters
36
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
37
- assert_equal 'POST', request_proxy.method
38
- end
39
-
40
- end
@@ -1,56 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
-
3
- class StubbedToken < OAuth::RequestToken
4
- define_method :build_authorize_url_promoted do |root_domain, params|
5
- build_authorize_url root_domain, params
6
- end
7
- end
8
-
9
- class TestRequestToken < Minitest::Test
10
- def setup
11
- # setup a fake req. token. mocking Consumer would be more appropriate...
12
- @request_token = OAuth::RequestToken.new(
13
- OAuth::Consumer.new("key", "secret", {}),
14
- "key",
15
- "secret"
16
- )
17
- end
18
-
19
- def test_request_token_builds_authorize_url_connectly_with_additional_params
20
- auth_url = @request_token.authorize_url({:oauth_callback => "github.com"})
21
- assert auth_url
22
- assert_match(/oauth_token/, auth_url)
23
- assert_match(/oauth_callback/, auth_url)
24
- end
25
-
26
- def test_request_token_builds_authorize_url_connectly_with_no_or_nil_params
27
- # we should only have 1 key in the url returned if we didn't pass anything.
28
- # this is the only required param to authenticate the client.
29
- auth_url = @request_token.authorize_url(nil)
30
- assert auth_url
31
- assert_match(/\?oauth_token=/, auth_url)
32
-
33
- auth_url = @request_token.authorize_url
34
- assert auth_url
35
- assert_match(/\?oauth_token=/, auth_url)
36
- end
37
-
38
- def test_request_token_returns_nil_authorize_url_when_token_is_nil
39
- @request_token.token = nil
40
- assert_nil @request_token.authorize_url
41
- end
42
-
43
- #TODO: mock out the Consumer to test the Consumer/AccessToken interaction.
44
- def test_get_access_token
45
- end
46
-
47
- def test_build_authorize_url
48
- @stubbed_token = StubbedToken.new(nil, nil, nil)
49
- assert_respond_to @stubbed_token, :build_authorize_url_promoted
50
- url = @stubbed_token.build_authorize_url_promoted(
51
- "http://github.com/oauth/authorize",
52
- {:foo => "bar bar"})
53
- assert url
54
- assert_equal "http://github.com/oauth/authorize?foo=bar+bar", url
55
- end
56
- end
@@ -1,81 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
-
3
- begin
4
- require 'oauth/request_proxy/rest_client_request'
5
- require 'rest-client'
6
-
7
- class RestlClientRequestProxyTest < Test::Unit::TestCase
8
-
9
- def test_that_proxy_simple_get_request_works
10
- request = ::RestClient::Request.new(method: :get, url: "http://example.com/test?key=value")
11
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value'})
12
-
13
- expected_parameters = {'key' => ['value']}
14
- assert_equal expected_parameters, request_proxy.parameters_for_signature
15
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
16
- assert_equal 'GET', request_proxy.method
17
- end
18
-
19
- def test_that_proxy_simple_post_request_works_with_arguments
20
- request = ::RestClient::Request.new(method: :post, url: "http://example.com/test")
21
- params = {'key' => 'value'}
22
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test', :parameters => params})
23
-
24
- expected_parameters = {'key' => 'value'}
25
- assert_equal expected_parameters, request_proxy.parameters_for_signature
26
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
27
- assert_equal 'POST', request_proxy.method
28
- end
29
-
30
- def test_that_proxy_simple_post_request_works_with_form_data
31
- request = ::RestClient::Request.new(method: :post, url: "http://example.com/test",
32
- payload: {'key' => 'value'},
33
- headers: {'Content-Type' => 'application/x-www-form-urlencoded'})
34
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test'})
35
-
36
- expected_parameters = {'key' => 'value'}
37
- assert_equal expected_parameters, request_proxy.parameters_for_signature
38
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
39
- assert_equal 'POST', request_proxy.method
40
- end
41
-
42
- def test_that_proxy_simple_put_request_works_with_arguments
43
- request = ::RestClient::Request.new(method: :put, url: "http://example.com/test")
44
- params = {'key' => 'value'}
45
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test', :parameters => params})
46
-
47
- expected_parameters = {'key' => 'value'}
48
- assert_equal expected_parameters, request_proxy.parameters_for_signature
49
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
50
- assert_equal 'PUT', request_proxy.method
51
- end
52
-
53
- def test_that_proxy_simple_put_request_works_with_form_data
54
- request = ::RestClient::Request.new(method: :put, url: "http://example.com/test",
55
- payload: {'key' => 'value'},
56
- headers: {'Content-Type' => 'application/x-www-form-urlencoded'})
57
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test'})
58
-
59
- expected_parameters = {'key' => 'value'}
60
- assert_equal expected_parameters, request_proxy.parameters_for_signature
61
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
62
- assert_equal 'PUT', request_proxy.method
63
- end
64
-
65
- def test_that_proxy_post_request_works_with_mixed_parameter_sources
66
- request = ::RestClient::Request.new(url: 'http://example.com/test?key=value',
67
- method: :post,
68
- payload: {'key2' => 'value2'},
69
- headers: {'Content-Type' => 'application/x-www-form-urlencoded'})
70
- request_proxy = OAuth::RequestProxy.proxy(request, {:uri => 'http://example.com/test?key=value', :parameters => {'key3' => 'value3'}})
71
-
72
- expected_parameters = {'key' => ['value'], 'key2' => 'value2', 'key3' => 'value3'}
73
- assert_equal expected_parameters, request_proxy.parameters_for_signature
74
- assert_equal 'http://example.com/test', request_proxy.normalized_uri
75
- assert_equal 'POST', request_proxy.method
76
- end
77
-
78
- end
79
- rescue LoadError => e
80
- warn "! problem loading rest-client, skipping these tests: #{e}"
81
- end
@@ -1,59 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
- require 'oauth/consumer'
3
- require 'oauth/signature/rsa/sha1'
4
-
5
- class TestSignatureRsaSha1 < Minitest::Test
6
-
7
- def setup
8
- @request = Net::HTTP::Get.new('/photos?file=vacaction.jpg&size=original&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_timestamp=1196666512&oauth_nonce=13917289812797014437&oauth_signature_method=RSA-SHA1')
9
-
10
- @consumer = OAuth::Consumer.new('dpf43f3p2l4k3l03', OpenSSL::PKey::RSA.new(IO.read(File.dirname(__FILE__) + "/keys/rsa.pem")))
11
-
12
- end
13
-
14
- def test_that_rsa_sha1_implements_rsa_sha1
15
- assert OAuth::Signature.available_methods.include?('rsa-sha1')
16
- end
17
-
18
- def test_that_get_request_from_oauth_test_cases_produces_matching_signature_base_string
19
- sbs = OAuth::Signature.signature_base_string(@request, { :consumer => @consumer,
20
- :uri => 'http://photos.example.net/photos' } )
21
-
22
- assert_equal 'GET&http%3A%2F%2Fphotos.example.net%2Fphotos&file%3Dvacaction.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3D13917289812797014437%26oauth_signature_method%3DRSA-SHA1%26oauth_timestamp%3D1196666512%26oauth_version%3D1.0%26size%3Doriginal', sbs
23
- end
24
-
25
- def test_that_get_request_from_oauth_test_cases_produces_matching_signature
26
- signature = OAuth::Signature.sign(@request, { :consumer => @consumer,
27
- :uri => 'http://photos.example.net/photos' } )
28
-
29
- assert_equal 'jvTp/wX1TYtByB1m+Pbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2/9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW//e+RinhejgCuzoH26dyF8iY2ZZ/5D1ilgeijhV/vBka5twt399mXwaYdCwFYE=', signature
30
-
31
- end
32
-
33
- def test_that_get_request_from_oauth_test_cases_produces_matching_signature_using_private_key_file
34
- @consumer = OAuth::Consumer.new('dpf43f3p2l4k3l03',nil)
35
-
36
- signature = OAuth::Signature.sign(@request, { :consumer => @consumer,
37
- :private_key_file=>File.dirname(__FILE__) + "/keys/rsa.pem",
38
- :uri => 'http://photos.example.net/photos' } )
39
-
40
- assert_equal 'jvTp/wX1TYtByB1m+Pbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2/9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW//e+RinhejgCuzoH26dyF8iY2ZZ/5D1ilgeijhV/vBka5twt399mXwaYdCwFYE=', signature
41
- end
42
-
43
- def test_that_get_request_from_oauth_test_cases_verifies_signature
44
- @request = Net::HTTP::Get.new('/photos?oauth_signature_method=RSA-SHA1&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_timestamp=1196666512&oauth_nonce=13917289812797014437&file=vacaction.jpg&size=original&oauth_signature=jvTp%2FwX1TYtByB1m%2BPbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2%2F9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW%2F%2Fe%2BRinhejgCuzoH26dyF8iY2ZZ%2F5D1ilgeijhV%2FvBka5twt399mXwaYdCwFYE%3D')
45
- @consumer = OAuth::Consumer.new('dpf43f3p2l4k3l03',OpenSSL::X509::Certificate.new(IO.read(File.dirname(__FILE__) + "/keys/rsa.cert")))
46
-
47
- assert OAuth::Signature.verify(@request, { :consumer => @consumer,
48
- :uri => 'http://photos.example.net/photos' } )
49
-
50
- end
51
-
52
- def test_that_get_request_from_oauth_test_cases_verifies_signature_with_pem
53
- @request = Net::HTTP::Get.new('/photos?oauth_signature_method=RSA-SHA1&oauth_version=1.0&oauth_consumer_key=dpf43f3p2l4k3l03&oauth_timestamp=1196666512&oauth_nonce=13917289812797014437&file=vacaction.jpg&size=original&oauth_signature=jvTp%2FwX1TYtByB1m%2BPbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2%2F9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW%2F%2Fe%2BRinhejgCuzoH26dyF8iY2ZZ%2F5D1ilgeijhV%2FvBka5twt399mXwaYdCwFYE%3D')
54
- assert OAuth::Signature.verify(@request, { :consumer => @consumer,
55
- :uri => 'http://photos.example.net/photos' } )
56
-
57
- end
58
-
59
- end
@@ -1,41 +0,0 @@
1
- require File.expand_path('../test_helper', __FILE__)
2
- require 'oauth/server'
3
-
4
- class ServerTest < Minitest::Test
5
- def setup
6
- @server=OAuth::Server.new "http://test.com"
7
- end
8
-
9
- def test_default_paths
10
- assert_equal "/oauth/request_token",@server.request_token_path
11
- assert_equal "/oauth/authorize",@server.authorize_path
12
- assert_equal "/oauth/access_token",@server.access_token_path
13
- end
14
-
15
- def test_default_urls
16
- assert_equal "http://test.com/oauth/request_token",@server.request_token_url
17
- assert_equal "http://test.com/oauth/authorize",@server.authorize_url
18
- assert_equal "http://test.com/oauth/access_token",@server.access_token_url
19
- end
20
-
21
- def test_generate_consumer_credentials
22
- consumer=@server.generate_consumer_credentials
23
- assert consumer.key
24
- assert consumer.secret
25
- end
26
-
27
- def test_create_consumer
28
- @consumer=@server.create_consumer
29
- assert @consumer
30
- assert @consumer.key
31
- assert @consumer.secret
32
- assert_equal "http://test.com",@consumer.site
33
- assert_equal "/oauth/request_token",@consumer.request_token_path
34
- assert_equal "/oauth/authorize",@consumer.authorize_path
35
- assert_equal "/oauth/access_token",@consumer.access_token_path
36
- assert_equal "http://test.com/oauth/request_token",@consumer.request_token_url
37
- assert_equal "http://test.com/oauth/authorize",@consumer.authorize_url
38
- assert_equal "http://test.com/oauth/access_token",@consumer.access_token_url
39
- end
40
-
41
- end