Skip to content

Commit

Permalink
Add test for oauth'd logic branch
Browse files Browse the repository at this point in the history
  • Loading branch information
wesrich committed Apr 17, 2017
1 parent 3e26300 commit 2c828bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/fhir_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ def get(path, headers)
begin
response = @client.get(url, headers: headers)
rescue => e
unless e.response
# Re-raise the client error if there's no response. Otherwise, logging
# and other things break below!
FHIR.logger.error "GET - Request: #{url} failed! No response from server: #{e}"
raise # Re-raise the same error we caught.
end
response = e.response if e.response
end
req = {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/basic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ def test_client_logs_without_response
client.read(FHIR::Patient, 123)
assert_requested stub
end
client.use_oauth2_auth = true
assert_raise RestClient::RequestTimeout do
client.read(FHIR::Patient, 123)
assert_requested stub
end
end
end

0 comments on commit 2c828bd

Please sign in to comment.