Skip to content

Commit

Permalink
Refactor test for http_options
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangtuanictvn committed Jan 15, 2021
1 parent 6757832 commit 22ec9c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/sendgrid/test_sendgrid-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,20 @@ def test_init_when_impersonate_subuser_is_not_given
end

def test_init_when_http_options_is_given
params = JSON.parse('{"subuser": "test_string", "ip": "test_string", "limit": 1, "exclude_whitelabels": "true", "offset": 1}')
headers = JSON.parse('{"X-Mock": 200}')
http_options = {
open_timeout: 40,
read_timeout: 40
}

sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', host: 'https://api.test.com', request_headers: headers, version: 'v3', http_options: http_options)
sg.client.get
sg = SendGrid::API.new(api_key: 'SENDGRID_API_KEY', version: 'v3', http_options: http_options)
client = sg.client.ips
response = client.get(query_params: params, request_headers: headers)

assert_equal(40, sg.client.http.open_timeout)
assert_equal(40, sg.client.http.read_timeout)
assert_equal(40, client.http.open_timeout)
assert_equal(40, client.http.read_timeout)
assert_equal('200', response.status_code)
end

def test_access_settings_activity_get
Expand Down

0 comments on commit 22ec9c0

Please sign in to comment.