Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix em_http_client tests

  • Loading branch information...
commit ffaced9cda93afb92af7761b59f545f4d0e39cf3 1 parent aa35512
@mojodna mojodna authored
Showing with 11 additions and 6 deletions.
  1. +7 −2 lib/oauth/client/em_http.rb
  2. +4 −4 test/test_em_http_client.rb
View
9 lib/oauth/client/em_http.rb
@@ -33,7 +33,12 @@ def oauth!(http, consumer = nil, token = nil, options = {})
:timestamp => nil }.merge(options)
@oauth_helper = OAuth::Client::Helper.new(self, options)
- self.send("set_oauth_#{options[:scheme]}")
+
+ # TODO this isn't executing properly, so it's currently hard-coded to the
+ # only supported scheme
+ # self.send("set_oauth_#{options[:scheme]}")
+
+ set_oauth_header
end
# Create a string suitable for signing for an HTTP request. This process involves parameter
@@ -91,4 +96,4 @@ def set_oauth_query_string
raise NotImplementedError, 'please use the set_oauth_header method instead'
end
-end
+end
View
8 test/test_em_http_client.rb
@@ -21,7 +21,7 @@ def test_that_using_auth_headers_on_get_requests_works
assert_equal 'GET', request.method
assert_equal '/test', request.normalize_uri.path
assert_equal "key=value", request.normalize_uri.query
- assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"HMAC-SHA1\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"1oO2izFav1GP4kEH2EskwXkCRFg%3D\", oauth_version=\"1.0\"".split(', ').sort, authz_header(request).split(', ').sort
+ assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"HMAC-SHA1\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"1oO2izFav1GP4kEH2EskwXkCRFg%3D\", oauth_version=\"1.0\""[6..-1].split(', ').sort, authz_header(request)[6..-1].split(', ').sort
end
def test_that_using_auth_headers_on_get_requests_works_with_plaintext
@@ -35,7 +35,7 @@ def test_that_using_auth_headers_on_get_requests_works_with_plaintext
assert_equal 'GET', request.method
assert_equal '/test', request.normalize_uri.path
assert_equal "key=value", request.normalize_uri.query
- assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"PLAINTEXT\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"5888bf0345e5d237%263196ffd991c8ebdb\", oauth_version=\"1.0\"".split(', ').sort, authz_header(request).split(', ').sort
+ assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"PLAINTEXT\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"5888bf0345e5d237%263196ffd991c8ebdb\", oauth_version=\"1.0\""[6..-1].split(', ').sort, authz_header(request)[6..-1].split(', ').sort
end
def test_that_using_auth_headers_on_post_requests_works
@@ -45,7 +45,7 @@ def test_that_using_auth_headers_on_post_requests_works
assert_equal 'POST', request.method
assert_equal '/test', request.uri.path
assert_equal 'key=value', request.normalize_body
- assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"HMAC-SHA1\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"26g7wHTtNO6ZWJaLltcueppHYiI%3D\", oauth_version=\"1.0\"".split(', ').sort, authz_header(request).split(', ').sort
+ assert_equal "OAuth oauth_nonce=\"225579211881198842005988698334675835446\", oauth_signature_method=\"HMAC-SHA1\", oauth_token=\"token_411a7f\", oauth_timestamp=\"1199645624\", oauth_consumer_key=\"consumer_key_86cad9\", oauth_signature=\"26g7wHTtNO6ZWJaLltcueppHYiI%3D\", oauth_version=\"1.0\""[6..-1].split(', ').sort, authz_header(request)[6..-1].split(', ').sort
end
protected
@@ -65,4 +65,4 @@ def authz_header(request)
headers['Authorization']
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.