Skip to content

Commit

Permalink
Merge pull request #247 from cben/ruby-2.4
Browse files Browse the repository at this point in the history
Support ruby 2.4
  • Loading branch information
abonas authored May 3, 2017
2 parents b95eff5 + 1065d39 commit 2770480
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rvm:
- "2.1"
- "2.2"
- "2.3.0"
- "2.4.0"
gemfile:
- Gemfile
- Gemfile-rest-client-1.8.rb
Expand Down
2 changes: 1 addition & 1 deletion kubeclient.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'minitest-rg'
spec.add_development_dependency 'webmock', '~> 1.24.2'
spec.add_development_dependency 'webmock', '~> 2.3.1'
spec.add_development_dependency 'vcr'
spec.add_development_dependency 'rubocop', '= 0.47.1'
spec.add_dependency 'rest-client'
Expand Down
21 changes: 13 additions & 8 deletions test/test_kubeclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,11 @@ def test_api_bearer_token_failure
end

def test_api_basic_auth_success
stub_request(:get, 'http://username:password@localhost:8080/api/v1')
stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
stub_request(:get, 'http://localhost:8080/api/v1/pods')
.with(basic_auth: %w(username password))
.to_return(body: open_test_file('pod_list.json'), status: 200)

client = Kubeclient::Client.new(
Expand All @@ -420,15 +422,17 @@ def test_api_basic_auth_success
assert_equal(1, pods.size)
assert_requested(
:get,
'http://username:password@localhost:8080/api/v1/pods',
'http://localhost:8080/api/v1/pods',
times: 1
)
end

def test_api_basic_auth_back_comp_success
stub_request(:get, 'http://username:password@localhost:8080/api/v1')
stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.to_return(body: open_test_file('core_api_resource_list.json'), status: 200)
stub_request(:get, 'http://username:password@localhost:8080/api/v1/pods')
stub_request(:get, 'http://localhost:8080/api/v1/pods')
.with(basic_auth: %w(username password))
.to_return(body: open_test_file('pod_list.json'), status: 200)

client = Kubeclient::Client.new(
Expand All @@ -440,14 +444,15 @@ def test_api_basic_auth_back_comp_success

assert_equal('Pod', pods.kind)
assert_equal(1, pods.size)
assert_requested(:get, 'http://username:password@localhost:8080/api/v1/pods', times: 1)
assert_requested(:get, 'http://localhost:8080/api/v1/pods', times: 1)
end

def test_api_basic_auth_failure
error_message = 'HTTP status code 401, 401 Unauthorized'
response = OpenStruct.new(code: 401, message: '401 Unauthorized')

stub_request(:get, 'http://username:password@localhost:8080/api/v1')
stub_request(:get, 'http://localhost:8080/api/v1')
.with(basic_auth: %w(username password))
.to_raise(Kubeclient::HttpError.new(401, error_message, response))

client = Kubeclient::Client.new(
Expand All @@ -459,7 +464,7 @@ def test_api_basic_auth_failure
assert_equal(401, exception.error_code)
assert_equal(error_message, exception.message)
assert_equal(response, exception.response)
assert_requested(:get, 'http://username:password@localhost:8080/api/v1', times: 1)
assert_requested(:get, 'http://localhost:8080/api/v1', times: 1)
end

def test_init_username_no_password
Expand Down

0 comments on commit 2770480

Please sign in to comment.