Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some http 5.1.1 test failures #41

Merged
merged 2 commits into from
Oct 9, 2023
Merged
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 test/unit/test_base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_set_credentials_from_path_invalid_auth_type_value
headers: {
"Connection" => "close",
"Host" => "iam.cloud.ibm.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_cp4d_authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_cp4d_authenticator
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"Connection" => "close",
"Host" => "icp.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down Expand Up @@ -77,7 +77,7 @@ def test_cp4d_authenticator_authenticate
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"Connection" => "close",
"Host" => "icp.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down
6 changes: 5 additions & 1 deletion test/unit/test_detailed_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

# Unit tests for the IAM Token Manager
class DetailedResponseTest < Minitest::Test
def example_request
HTTP::Request.new({ uri: "http://example.com", verb: :get })
pyrooka marked this conversation as resolved.
Show resolved Hide resolved
end

def test_detailed_response
res = IBMCloudSdkCore::DetailedResponse.new(status: 200, headers: {}, body: {}, response: { code: 401 })
assert_equal(res.status, 200)
Expand All @@ -20,7 +24,7 @@ def test_detailed_response_when_no_arguments
end

def test_detailed_response_when_only_response
response = IBMCloudSdkCore::DetailedResponse.new(response: HTTP::Response.new(status: 401, version: 1, body: {}))
response = IBMCloudSdkCore::DetailedResponse.new(response: HTTP::Response.new({ request: example_request, status: 401, version: 1, body: {} }))
pyrooka marked this conversation as resolved.
Show resolved Hide resolved
assert_equal(response.status, 401)
end
end
8 changes: 4 additions & 4 deletions test/unit/test_iam_authenticator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_iam_authenticator
headers: {
"Connection" => "close",
"Host" => "iam.cloud.ibm.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down Expand Up @@ -83,7 +83,7 @@ def test_iam_authenticator_client_id_client_secret
"Connection" => "close",
"Authorization" => "Basic Yng6Yng=",
"Host" => "iam.cloud.ibm.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down Expand Up @@ -126,7 +126,7 @@ def test_cp4d_authenticator_authenticate
headers: {
"Connection" => "close",
"Host" => "iam.cloud.ibm.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down Expand Up @@ -173,7 +173,7 @@ def test_iam_authenticator_auth_url
headers: {
"Connection" => "close",
"Host" => "my.link",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_jwt_token_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_cp4d_disable_ssl
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
"Connection" => "close",
"Host" => "icp.com",
"User-Agent" => "http.rb/4.4.1"
"User-Agent" => "http.rb/#{HTTP::VERSION}"
}
)
.to_return(status: 200, body: response.to_json, headers: {})
Expand Down