-
Notifications
You must be signed in to change notification settings - Fork 0
1. Accepting User Bearer Token Input
The inferno-template test kit includes the ability for users to input values for service base url, credentials, access_token and Refresh Token and patient_id:
We want to add the ability for the end-user to input an access_token which is used later as a bearer_token.
In order to add the ability for an end-user to input an access_token, we can include the following code in the inferno_template.rb file:
# This input will be available to all tests in the suite
input :url
input :access_tokenThe code input :access_token adds a user input for "access_token" to the test input modal.
Now that we have the ability to collect the access_token from the end-user, we want to use the access_token for authentication. We can do this by associating bearer_token with :access_token by following the code below:
# All FHIR requests in the suite will use this FHIR client
fhir_client do
url :url
bearer_token :access_token
enddiff between step-1 and step-1-solution branches: https://github.com/inferno-training/inferno-tutorial/compare/step-1...step-1-solution
- Inferno Framework Inputs and Outputs overview
- Inferno Framework FHIR Requests overview
Since we are writing tests for servers, it is helpful to have reference servers to develop tests against. Some commonly used reference servers, loaded with data, include:
-
Inferno Standardized API Demonstration Server: https://inferno.healthit.gov/reference-server/r4. This server is protected by a simple mock OAuth2.0 implementation, which can be bypassed by using
SAMPLE_TOKENbearer token. Use patient85or355. - HAPI Public Server: https://hapi.fhir.org/r4
Additional public test servers are listed on the HL7 Confluence Public Test Servers Page