Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source 'https://rubygems.org'
gemspec

group :test do
gem "codeclimate-test-reporter", require: nil
gem "codeclimate-test-reporter", "< 1.0", require: nil
end
6 changes: 3 additions & 3 deletions test/integration/consumer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_that_signing_post_params_works
assert_equal 'POST', request.method
assert_equal '/test', request.path
assert_match(/key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=26g7wHTtNO6ZWJaLltcueppHYiI%3[Dd]&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0/, request.body.split("&").sort.join("&"))
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_auth_headers_on_get_on_create_signed_requests_works
Expand All @@ -112,7 +112,7 @@ def test_that_signing_post_params_works_2
assert_equal 'POST', request.method
assert_equal '/test', request.path
assert_match(/key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=26g7wHTtNO6ZWJaLltcueppHYiI%3[Dd]&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0/, request.body.split("&").sort.join("&"))
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_step_by_step_token_request
Expand All @@ -136,7 +136,7 @@ def test_step_by_step_token_request
@consumer.sign!(request, nil,options)

assert_equal 'GET', request.method
assert_equal nil, request.body
assert_nil request.body
response=@consumer.http.request(request)
assert_equal "200",response.code
assert_equal "oauth_token=requestkey&oauth_token_secret=requestsecret",response.body
Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ENV['RACK_ENV'] = 'test'

require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
require "simplecov"
SimpleCov.start

require 'rubygems'
require 'minitest/autorun'
Expand Down
26 changes: 13 additions & 13 deletions test/units/test_net_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def test_that_using_get_params_works
assert_equal 'GET', request.method
uri = URI.parse(request.path)
assert_equal '/test', uri.path
assert_equal nil, uri.fragment
assert_nil uri.fragment
assert_equal "key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=1oO2izFav1GP4kEH2EskwXkCRFg%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", uri.query.split("&").sort.join("&")
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_get_params_works_with_plaintext
Expand All @@ -117,9 +117,9 @@ def test_that_using_get_params_works_with_plaintext
assert_equal 'GET', request.method
uri = URI.parse(request.path)
assert_equal '/test', uri.path
assert_equal nil, uri.fragment
assert_nil uri.fragment
assert_equal "key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=5888bf0345e5d237%263196ffd991c8ebdb&oauth_signature_method=PLAINTEXT&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", uri.query.split("&").sort.join("&")
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_post_params_works
Expand All @@ -130,7 +130,7 @@ def test_that_using_post_params_works
assert_equal 'POST', request.method
assert_equal '/test', request.path
assert_match(/key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=26g7wHTtNO6ZWJaLltcueppHYiI%3[Dd]&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0/, request.body.split("&").sort.join("&"))
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_post_params_works_with_plaintext
Expand All @@ -141,7 +141,7 @@ def test_that_using_post_params_works_with_plaintext
assert_equal 'POST', request.method
assert_equal '/test', request.path
assert_equal "key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=5888bf0345e5d237%263196ffd991c8ebdb&oauth_signature_method=PLAINTEXT&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", request.body.split("&").sort.join("&")
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_post_body_works
Expand All @@ -153,7 +153,7 @@ def test_that_using_post_body_works
assert_equal 'POST', request.method
assert_equal '/test', request.path
assert_match(/OAuth oauth_consumer_key="consumer_key_86cad9", oauth_nonce="225579211881198842005988698334675835446", oauth_signature="%2[fF]DMMBOJzQ6JmEaXlAXDLGtD1z2I%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1199645624", oauth_token="token_411a7f", oauth_version="1.0"/, request['authorization'].split("&").sort.join("&"))
# assert_equal nil, request['authorization']
# assert_nil request['authorization']
end

def test_that_using_post_with_uri_params_works
Expand All @@ -164,10 +164,10 @@ def test_that_using_post_with_uri_params_works
assert_equal 'POST', request.method
uri = URI.parse(request.path)
assert_equal '/test', uri.path
assert_equal nil, uri.fragment
assert_nil uri.fragment
assert_equal "key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=26g7wHTtNO6ZWJaLltcueppHYiI%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", uri.query.split("&").sort.join('&')
assert_equal "", request.body
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_post_with_uri_and_form_params_works
Expand All @@ -178,10 +178,10 @@ def test_that_using_post_with_uri_and_form_params_works
assert_equal 'POST', request.method
uri = URI.parse(request.path)
assert_equal '/test', uri.path
assert_equal nil, uri.fragment
assert_nil uri.fragment
assert_equal "key=value&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=4kSU8Zd1blWo3W6qJH7eaRTMkg0%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", uri.query.split("&").sort.join('&')
assert_equal "key2=value2", request.body
assert_equal nil, request['authorization']
assert_nil request['authorization']
end

def test_that_using_post_with_uri_and_data_works
Expand All @@ -193,11 +193,11 @@ def test_that_using_post_with_uri_and_data_works
assert_equal 'POST', request.method
uri = URI.parse(request.path)
assert_equal '/test', uri.path
assert_equal nil, uri.fragment
assert_nil uri.fragment
assert_equal "data", request.body
assert_equal 'text/ascii', request.content_type
assert_equal "key=value&oauth_body_hash=oXyaqmHoChv3HQ2FCvTluqmAC70%3D&oauth_consumer_key=consumer_key_86cad9&oauth_nonce=225579211881198842005988698334675835446&oauth_signature=MHRKU42iVHU4Ke9kBUDa9Zw6IAM%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1199645624&oauth_token=token_411a7f&oauth_version=1.0", uri.query.split("&").sort.join('&')
assert_equal nil, request['authorization']
assert_nil request['authorization']
end


Expand Down