onc_certification_g10_test_kit 7.0.3 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/g10_reference_server_preset.json +1467 -0
  3. data/lib/inferno/ext/bloomer.rb +1 -1
  4. data/lib/inferno/terminology/tasks/process_umls.rb +1 -1
  5. data/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb +73 -67
  6. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb +1 -2
  7. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2.rb +7 -1
  8. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_parameters.rb +1 -1
  9. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb +10 -2
  10. data/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb +6 -2
  11. data/lib/onc_certification_g10_test_kit/bulk_export_validation_tester.rb +7 -3
  12. data/lib/onc_certification_g10_test_kit/configuration_checker.rb +5 -13
  13. data/lib/onc_certification_g10_test_kit/encounter_context_test.rb +3 -3
  14. data/lib/onc_certification_g10_test_kit/export_kick_off_performer.rb +7 -3
  15. data/lib/onc_certification_g10_test_kit/feature.rb +5 -4
  16. data/lib/onc_certification_g10_test_kit/igs/01-us-core-v400.tgz +0 -0
  17. data/lib/onc_certification_g10_test_kit/igs/03-us-core-v311.tgz +0 -0
  18. data/lib/onc_certification_g10_test_kit/igs/04-us-core-610.tgz +0 -0
  19. data/lib/onc_certification_g10_test_kit/metadata.rb +103 -0
  20. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu1.rb +0 -4
  21. data/lib/onc_certification_g10_test_kit/multi_patient_api_stu2.rb +8 -4
  22. data/lib/onc_certification_g10_test_kit/patient_context_test.rb +3 -3
  23. data/lib/onc_certification_g10_test_kit/patient_scope_test.rb +1 -1
  24. data/lib/onc_certification_g10_test_kit/restricted_resource_type_access_group.rb +3 -10
  25. data/lib/onc_certification_g10_test_kit/scope_constants.rb +52 -0
  26. data/lib/onc_certification_g10_test_kit/short_id_map.yml +11 -20
  27. data/lib/onc_certification_g10_test_kit/single_patient_api_group.rb +18 -17
  28. data/lib/onc_certification_g10_test_kit/single_patient_us_core_4_api_group.rb +18 -17
  29. data/lib/onc_certification_g10_test_kit/single_patient_us_core_5_api_group.rb +18 -17
  30. data/lib/onc_certification_g10_test_kit/single_patient_us_core_6_api_group.rb +20 -19
  31. data/lib/onc_certification_g10_test_kit/single_patient_us_core_7_api_group.rb +20 -19
  32. data/lib/onc_certification_g10_test_kit/smart_app_launch_invalid_aud_group.rb +108 -65
  33. data/lib/onc_certification_g10_test_kit/smart_asymmetric_launch_group.rb +42 -89
  34. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group.rb +33 -43
  35. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group_stu2.rb +32 -54
  36. data/lib/onc_certification_g10_test_kit/smart_ehr_patient_launch_group_stu2_2.rb +34 -55
  37. data/lib/onc_certification_g10_test_kit/smart_ehr_practitioner_app_group.rb +103 -146
  38. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_group.rb +17 -55
  39. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_group_stu2_2.rb +17 -55
  40. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group.rb +17 -55
  41. data/lib/onc_certification_g10_test_kit/smart_fine_grained_scopes_us_core_7_group_stu2_2.rb +17 -55
  42. data/lib/onc_certification_g10_test_kit/smart_granular_scope_selection_group.rb +33 -68
  43. data/lib/onc_certification_g10_test_kit/smart_granular_scope_selection_test.rb +4 -3
  44. data/lib/onc_certification_g10_test_kit/smart_invalid_pkce_group.rb +45 -89
  45. data/lib/onc_certification_g10_test_kit/smart_invalid_token_group.rb +45 -89
  46. data/lib/onc_certification_g10_test_kit/smart_invalid_token_group_stu2.rb +53 -91
  47. data/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb +9 -6
  48. data/lib/onc_certification_g10_test_kit/smart_limited_app_group.rb +86 -278
  49. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group.rb +32 -59
  50. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group_stu2.rb +36 -75
  51. data/lib/onc_certification_g10_test_kit/smart_public_standalone_launch_group_stu2_2.rb +36 -75
  52. data/lib/onc_certification_g10_test_kit/smart_scopes_test.rb +6 -1
  53. data/lib/onc_certification_g10_test_kit/smart_standalone_patient_app_group.rb +90 -118
  54. data/lib/onc_certification_g10_test_kit/smart_v1_scopes_group.rb +62 -116
  55. data/lib/onc_certification_g10_test_kit/tasks/generate_matrix.rb +3 -12
  56. data/lib/onc_certification_g10_test_kit/token_introspection_group.rb +12 -25
  57. data/lib/onc_certification_g10_test_kit/token_introspection_group_stu2_2.rb +12 -14
  58. data/lib/onc_certification_g10_test_kit/token_revocation_group.rb +44 -33
  59. data/lib/onc_certification_g10_test_kit/unrestricted_resource_type_access_group.rb +3 -3
  60. data/lib/onc_certification_g10_test_kit/urls.rb +4 -0
  61. data/lib/onc_certification_g10_test_kit/version.rb +2 -1
  62. data/lib/onc_certification_g10_test_kit.rb +119 -65
  63. metadata +20 -68
@@ -18,7 +18,7 @@ class Bloomer
18
18
  def self.initial_size(length)
19
19
  size = 2**Math.log2(length).ceil
20
20
 
21
- size < 256 ? 256 : size
21
+ [size, 256].max
22
22
  end
23
23
  end
24
24
  end
@@ -37,7 +37,7 @@ module Inferno
37
37
  case code_system
38
38
  when 'SNOMEDCT_US'
39
39
  code_system = 'SNOMED'
40
- include_code = (row[4] == 'PF' && ['FN', 'OAF'].include?(row[12]))
40
+ include_code = row[4] == 'PF' && ['FN', 'OAF'].include?(row[12])
41
41
  when 'LNC'
42
42
  code_system = 'LOINC'
43
43
  include_code = true
@@ -7,43 +7,33 @@ module ONCCertificationG10TestKit
7
7
 
8
8
  id :bulk_data_authorization
9
9
 
10
- input :bulk_token_endpoint,
11
- title: 'Backend Services Token Endpoint',
12
- description: <<~DESCRIPTION
13
- The OAuth 2.0 Token Endpoint used by the Backend Services specification to provide bearer tokens.
14
- DESCRIPTION
15
- input :bulk_client_id,
16
- title: 'Bulk Data Client ID',
17
- description: 'Client ID provided at registration to the Inferno application.'
18
- input :bulk_scope,
19
- title: 'Bulk Data Scopes',
20
- description: 'Bulk Data Scopes provided at registration to the Inferno application.',
21
- default: 'system/*.read'
22
- input :bulk_encryption_method,
23
- title: 'Encryption Method',
24
- description: <<~DESCRIPTION,
25
- The server is required to suport either ES384 or RS384 encryption methods for JWT signature verification.
26
- Select which method to use.
27
- DESCRIPTION
28
- type: 'radio',
29
- default: 'ES384',
10
+ input :bulk_smart_auth_info,
11
+ type: :auth_info,
12
+ title: 'Multi-Patient API Credentials',
30
13
  options: {
31
- list_options: [
14
+ mode: :auth,
15
+ components: [
32
16
  {
33
- label: 'ES384',
34
- value: 'ES384'
17
+ name: :auth_type,
18
+ default: 'backend_services',
19
+ locked: true
35
20
  },
36
21
  {
37
- label: 'RS384',
38
- value: 'RS384'
22
+ name: :use_discovery,
23
+ default: false,
24
+ locked: true
25
+ },
26
+ {
27
+ name: :token_url,
28
+ optional: false
29
+ },
30
+ {
31
+ name: :jwks,
32
+ locked: true
39
33
  }
40
34
  ]
41
35
  }
42
- output :bearer_token
43
-
44
- http_client :token_endpoint do
45
- url :bulk_token_endpoint
46
- end
36
+ output :bulk_smart_auth_info
47
37
 
48
38
  test from: :tls_version_test do
49
39
  title 'Authorization service token endpoint secured by transport layer security'
@@ -56,8 +46,13 @@ module ONCCertificationG10TestKit
56
46
  DESCRIPTION
57
47
  id :g10_bulk_token_tls_version
58
48
 
49
+ input :bulk_smart_auth_info, type: :auth_info
50
+
51
+ def url
52
+ bulk_smart_auth_info.token_url
53
+ end
54
+
59
55
  config(
60
- inputs: { url: { name: :bulk_token_endpoint } },
61
56
  options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
62
57
  )
63
58
  end
@@ -80,14 +75,17 @@ module ONCCertificationG10TestKit
80
75
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#protocol-details'
81
76
 
82
77
  run do
83
- post_request_content = AuthorizationRequestBuilder.build(encryption_method: bulk_encryption_method,
84
- scope: bulk_scope,
85
- iss: bulk_client_id,
86
- sub: bulk_client_id,
87
- aud: bulk_token_endpoint,
88
- grant_type: 'not_a_grant_type')
89
-
90
- post(**{ client: :token_endpoint }.merge(post_request_content))
78
+ post_request_content =
79
+ AuthorizationRequestBuilder.build(
80
+ encryption_method: bulk_smart_auth_info.encryption_algorithm,
81
+ scope: bulk_smart_auth_info.requested_scopes,
82
+ iss: bulk_smart_auth_info.client_id,
83
+ sub: bulk_smart_auth_info.client_id,
84
+ aud: bulk_smart_auth_info.token_url,
85
+ grant_type: 'not_a_grant_type'
86
+ )
87
+
88
+ post(bulk_smart_auth_info.token_url, **post_request_content)
91
89
 
92
90
  assert_response_status(400)
93
91
  end
@@ -111,14 +109,17 @@ module ONCCertificationG10TestKit
111
109
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#protocol-details'
112
110
 
113
111
  run do
114
- post_request_content = AuthorizationRequestBuilder.build(encryption_method: bulk_encryption_method,
115
- scope: bulk_scope,
116
- iss: bulk_client_id,
117
- sub: bulk_client_id,
118
- aud: bulk_token_endpoint,
119
- client_assertion_type: 'not_an_assertion_type')
120
-
121
- post(**{ client: :token_endpoint }.merge(post_request_content))
112
+ post_request_content =
113
+ AuthorizationRequestBuilder.build(
114
+ encryption_method: bulk_smart_auth_info.encryption_algorithm,
115
+ scope: bulk_smart_auth_info.requested_scopes,
116
+ iss: bulk_smart_auth_info.client_id,
117
+ sub: bulk_smart_auth_info.client_id,
118
+ aud: bulk_smart_auth_info.token_url,
119
+ client_assertion_type: 'not_an_assertion_type'
120
+ )
121
+
122
+ post(bulk_smart_auth_info.token_url, **post_request_content)
122
123
 
123
124
  assert_response_status(400)
124
125
  end
@@ -151,13 +152,16 @@ module ONCCertificationG10TestKit
151
152
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#protocol-details'
152
153
 
153
154
  run do
154
- post_request_content = AuthorizationRequestBuilder.build(encryption_method: bulk_encryption_method,
155
- scope: bulk_scope,
156
- iss: 'not_a_valid_iss',
157
- sub: bulk_client_id,
158
- aud: bulk_token_endpoint)
155
+ post_request_content =
156
+ AuthorizationRequestBuilder.build(
157
+ encryption_method: bulk_smart_auth_info.encryption_algorithm,
158
+ scope: bulk_smart_auth_info.requested_scopes,
159
+ iss: 'not_a_valid_iss',
160
+ sub: bulk_smart_auth_info.client_id,
161
+ aud: bulk_smart_auth_info.token_url
162
+ )
159
163
 
160
- post(**{ client: :token_endpoint }.merge(post_request_content))
164
+ post(bulk_smart_auth_info.token_url, **post_request_content)
161
165
 
162
166
  assert_response_status([400, 401])
163
167
  end
@@ -170,20 +174,21 @@ module ONCCertificationG10TestKit
170
174
  DESCRIPTION
171
175
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#issuing-access-tokens'
172
176
 
173
- output :authentication_response
177
+ makes_request :bulk_authentication
174
178
 
175
179
  run do
176
- post_request_content = AuthorizationRequestBuilder.build(encryption_method: bulk_encryption_method,
177
- scope: bulk_scope,
178
- iss: bulk_client_id,
179
- sub: bulk_client_id,
180
- aud: bulk_token_endpoint)
180
+ post_request_content =
181
+ AuthorizationRequestBuilder.build(
182
+ encryption_method: bulk_smart_auth_info.encryption_algorithm,
183
+ scope: bulk_smart_auth_info.requested_scopes,
184
+ iss: bulk_smart_auth_info.client_id,
185
+ sub: bulk_smart_auth_info.client_id,
186
+ aud: bulk_smart_auth_info.token_url
187
+ )
181
188
 
182
- authentication_response = post(**{ client: :token_endpoint }.merge(post_request_content))
189
+ post(bulk_smart_auth_info.token_url, **post_request_content, name: :bulk_authentication)
183
190
 
184
191
  assert_response_status([200, 201])
185
-
186
- output authentication_response: authentication_response.response_body
187
192
  end
188
193
  end
189
194
 
@@ -201,17 +206,18 @@ module ONCCertificationG10TestKit
201
206
  DESCRIPTION
202
207
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#issuing-access-tokens'
203
208
 
204
- input :authentication_response
205
- output :bearer_token
209
+ uses_request :bulk_authentication
210
+ output :bulk_smart_auth_info
206
211
 
207
212
  run do
208
- assert_valid_json(authentication_response)
209
- response_body = JSON.parse(authentication_response)
213
+ assert_valid_json(request.response_body)
214
+ response_body = JSON.parse(request.response_body)
210
215
 
211
216
  access_token = response_body['access_token']
212
217
  assert access_token.present?, 'Token response did not contain access_token as required'
213
218
 
214
- output bearer_token: access_token
219
+ bulk_smart_auth_info.update_from_response_body(request)
220
+ output bulk_smart_auth_info: bulk_smart_auth_info
215
221
 
216
222
  required_keys = ['token_type', 'expires_in', 'scope']
217
223
 
@@ -10,8 +10,7 @@ module ONCCertificationG10TestKit
10
10
  correct behavior.
11
11
  )
12
12
 
13
- input :bearer_token,
14
- optional: true
13
+ input :bulk_smart_auth_info, type: :auth_info
15
14
  input :bulk_server_url,
16
15
  title: 'Bulk Data FHIR URL',
17
16
  description: 'The URL of the Bulk FHIR server.'
@@ -21,7 +21,13 @@ module ONCCertificationG10TestKit
21
21
  run do
22
22
  skip 'No polling url available' unless cancelled_polling_url.present?
23
23
 
24
- get(cancelled_polling_url, headers: { authorization: "Bearer #{bearer_token}", accept: 'application/json' })
24
+ get(
25
+ cancelled_polling_url,
26
+ headers: {
27
+ authorization: "Bearer #{bulk_smart_auth_info.access_token}",
28
+ accept: 'application/json'
29
+ }
30
+ )
25
31
 
26
32
  assert_response_status(404)
27
33
 
@@ -8,7 +8,7 @@ module ONCCertificationG10TestKit
8
8
  Verify that the Bulk Data server supports required query parameters.
9
9
  )
10
10
 
11
- input :bearer_token
11
+ input :bulk_smart_auth_info, type: :auth_info
12
12
  input :bulk_server_url,
13
13
  title: 'Bulk Data FHIR URL',
14
14
  description: 'The URL of the Bulk FHIR server.'
@@ -9,7 +9,7 @@ module ONCCertificationG10TestKit
9
9
  DESCRIPTION
10
10
  id :bulk_data_group_export
11
11
 
12
- input :bearer_token
12
+ input :bulk_smart_auth_info, type: :auth_info
13
13
  input :bulk_server_url,
14
14
  title: 'Bulk Data FHIR URL',
15
15
  description: 'The URL of the Bulk FHIR server.'
@@ -137,6 +137,8 @@ module ONCCertificationG10TestKit
137
137
  include ExportKickOffPerformer
138
138
 
139
139
  run do
140
+ skip_if bulk_smart_auth_info.access_token.blank?, 'No access token was received'
141
+
140
142
  perform_export_kick_off_request(use_token: false)
141
143
  assert_response_status([400, 401])
142
144
  end
@@ -199,7 +201,13 @@ module ONCCertificationG10TestKit
199
201
  used_time = 0
200
202
 
201
203
  loop do
202
- get(polling_url, headers: { authorization: "Bearer #{bearer_token}", accept: 'application/json' })
204
+ get(
205
+ polling_url,
206
+ headers: {
207
+ authorization: "Bearer #{bulk_smart_auth_info.access_token}",
208
+ accept: 'application/json'
209
+ }
210
+ )
203
211
 
204
212
  retry_after_val = request.response_header('retry-after')&.value.to_i
205
213
 
@@ -10,7 +10,8 @@ module ONCCertificationG10TestKit
10
10
 
11
11
  id :g10_bulk_data_group_export_validation
12
12
 
13
- input :status_output, :requires_access_token, :bearer_token, :bulk_download_url
13
+ input :status_output, :requires_access_token, :bulk_download_url
14
+ input :bulk_smart_auth_info, type: :auth_info
14
15
  input :lines_to_validate,
15
16
  title: 'Limit validation to a maximum resource count',
16
17
  description: 'To validate all, leave blank.',
@@ -62,12 +63,15 @@ module ONCCertificationG10TestKit
62
63
  DESCRIPTION
63
64
  # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/export/index.html#file-request'
64
65
 
65
- input :bulk_download_url, :requires_access_token, :requires_access_token, :bearer_token
66
+ input :bulk_download_url, :requires_access_token
67
+ input :bulk_smart_auth_info, type: :auth_info
66
68
 
67
69
  run do
68
70
  omit_if requires_access_token == 'false',
69
71
  'Could not verify this functionality when requiresAccessToken is false'
70
72
 
73
+ skip_if bulk_smart_auth_info.access_token.blank?, 'No access token was received'
74
+
71
75
  get(bulk_download_url, headers: { accept: 'application/fhir+ndjson' })
72
76
  assert_response_status([400, 401])
73
77
  end
@@ -36,6 +36,10 @@ module ONCCertificationG10TestKit
36
36
  scratch[:patient_ids_seen] ||= []
37
37
  end
38
38
 
39
+ def bearer_token
40
+ bulk_smart_auth_info.access_token
41
+ end
42
+
39
43
  def build_headers(use_token)
40
44
  headers = { accept: 'application/fhir+ndjson' }
41
45
  headers.merge!({ authorization: "Bearer #{bearer_token}" }) if use_token == 'true'
@@ -43,13 +47,13 @@ module ONCCertificationG10TestKit
43
47
  end
44
48
 
45
49
  def stream_ndjson(endpoint, headers, process_chunk_line, process_response) # rubocop:disable Metrics/CyclomaticComplexity
46
- hanging_chunk = String.new
50
+ hanging_chunk = ''
47
51
 
48
52
  process_body = proc { |chunk|
49
53
  hanging_chunk << chunk
50
54
  chunk_by_lines = hanging_chunk.lines
51
55
 
52
- hanging_chunk = chunk_by_lines.pop || String.new
56
+ hanging_chunk = chunk_by_lines.pop || ''
53
57
 
54
58
  chunk_by_lines.each do |elem|
55
59
  process_chunk_line.call(elem)
@@ -89,7 +93,7 @@ module ONCCertificationG10TestKit
89
93
  coding.code if coding.system.nil? || coding.system == 'http://snomed.info/sct'
90
94
  end
91
95
 
92
- (expected & actual).any?
96
+ expected.intersect?(actual)
93
97
  end
94
98
 
95
99
  def determine_profile(resource)
@@ -2,9 +2,7 @@ require_relative '../inferno/terminology/tasks/check_built_terminology'
2
2
 
3
3
  module ONCCertificationG10TestKit
4
4
  class ConfigurationChecker
5
- EXPECTED_VALIDATOR_VERSION = '2.3.2'.freeze
6
- INFERNO_VALIDATOR_VERSION_KEY = 'inferno-framework/fhir-validator-wrapper'.freeze
7
- EXPECTED_HL7_VALIDATOR_VERSION = '1.0.60'.freeze
5
+ EXPECTED_HL7_VALIDATOR_VERSION = '1.0.65'.freeze
8
6
  HL7_VALIDATOR_VERSION_KEY = 'validatorWrapperVersion'.freeze
9
7
 
10
8
  def configuration_messages
@@ -24,15 +22,9 @@ module ONCCertificationG10TestKit
24
22
  end
25
23
 
26
24
  def validator_version_message
27
- if Feature.use_hl7_resource_validator?
28
- expected_validator_version = EXPECTED_HL7_VALIDATOR_VERSION
29
- validator_version_key = HL7_VALIDATOR_VERSION_KEY
30
- validator_version_url = "#{validator_url}/validator/version"
31
- else
32
- expected_validator_version = EXPECTED_VALIDATOR_VERSION
33
- validator_version_key = INFERNO_VALIDATOR_VERSION_KEY
34
- validator_version_url = "#{validator_url}/version"
35
- end
25
+ expected_validator_version = EXPECTED_HL7_VALIDATOR_VERSION
26
+ validator_version_key = HL7_VALIDATOR_VERSION_KEY
27
+ validator_version_url = "#{validator_url}/validator/version"
36
28
 
37
29
  response = Faraday.get validator_version_url
38
30
  if response.body.starts_with? '{'
@@ -71,7 +63,7 @@ module ONCCertificationG10TestKit
71
63
 
72
64
  cs_metadata = YAML.load_file(path)
73
65
  message = "Terminology was generated based on the following code system versions:\n"
74
- cs_metadata.each do |_url, metadata|
66
+ cs_metadata.each_value do |metadata|
75
67
  message += "* #{metadata[:name]}: version #{metadata[:versions].join(', ')}\n"
76
68
  end
77
69
 
@@ -7,15 +7,15 @@ module ONCCertificationG10TestKit
7
7
  )
8
8
  id :g10_encounter_context
9
9
  input :encounter_id, :url
10
- input :smart_credentials, type: :oauth_credentials
10
+ input :smart_auth_info, type: :auth_info
11
11
 
12
12
  fhir_client :authenticated do
13
13
  url :url
14
- oauth_credentials :smart_credentials
14
+ auth_info :smart_auth_info
15
15
  end
16
16
 
17
17
  run do
18
- skip_if smart_credentials.access_token.blank?, 'No access token was received during the SMART launch'
18
+ skip_if smart_auth_info.access_token.blank?, 'No access token was received during the SMART launch'
19
19
 
20
20
  skip_if encounter_id.blank?, 'Token response did not contain `encounter` field'
21
21
 
@@ -1,10 +1,14 @@
1
1
  module ONCCertificationG10TestKit
2
2
  module ExportKickOffPerformer
3
+ def access_token
4
+ bulk_smart_auth_info.access_token
5
+ end
6
+
3
7
  def perform_export_kick_off_request(use_token: true, params: {})
4
- skip_if use_token && bearer_token.blank?, 'Could not verify this functionality when bearer token is not set'
8
+ skip_if use_token && access_token.blank?, 'Could not verify this functionality when bearer token is not set'
5
9
 
6
10
  headers = { accept: 'application/fhir+json', prefer: 'respond-async' }
7
- headers.merge!({ authorization: "Bearer #{bearer_token}" }) if use_token
11
+ headers.merge!({ authorization: "Bearer #{access_token}" }) if use_token
8
12
 
9
13
  url = "Group/#{group_id}/$export"
10
14
  param_str = params.map { |k, v| URI.encode_www_form(k => v) }.join('&')
@@ -16,7 +20,7 @@ module ONCCertificationG10TestKit
16
20
  polling_url = request&.response_header('content-location')&.value
17
21
  assert polling_url.present?, 'Export response header did not include "Content-Location"'
18
22
 
19
- headers = { accept: 'application/json', authorization: "Bearer #{bearer_token}" }
23
+ headers = { accept: 'application/json', authorization: "Bearer #{access_token}" }
20
24
 
21
25
  delete(polling_url, headers:)
22
26
  assert_response_status(202)
@@ -1,9 +1,10 @@
1
1
  module ONCCertificationG10TestKit
2
2
  module Feature
3
- class << self
4
- def use_hl7_resource_validator?
5
- ENV.fetch('USE_HL7_RESOURCE_VALIDATOR', 'false')&.casecmp?('true')
6
- end
3
+ class << self # rubocop:disable Lint/EmptyClass
4
+ # This is how you can define feature flags to be used in the g10 test kit
5
+ # def us_core_v4?
6
+ # ENV.fetch('US_CORE_4_ENABLED', 'false')&.casecmp?('true')
7
+ # end
7
8
  end
8
9
  end
9
10
  end
@@ -0,0 +1,103 @@
1
+ require_relative 'version'
2
+
3
+ module ONCCertificationG10TestKit
4
+ class Metadata < Inferno::TestKit
5
+ id :onc_certification_g10_test_kit
6
+ title 'ONC Certification (g)(10) Standardized API Test Kit'
7
+ description <<~DESCRIPTION
8
+ The ONC Certification (g)(10) Standardized API Test Kit is a testing tool for
9
+ Health IT systems seeking to meet the requirements of the Standardized API for
10
+ Patient and Population Services criterion § 170.315(g)(10) in the ONC
11
+ Certification Program. It is an approved test method for the [§ 170.315(g)(10)
12
+ test
13
+ procedure](https://www.healthit.gov/test-method/standardized-api-patient-and-population-services#test_procedure).
14
+ <!-- break -->
15
+
16
+ Systems may adopt later versions of standards than those named in the rule as
17
+ approved by the ONC Standards Version Advancement Process (SVAP). Please note
18
+ that US Core Implementation Guide v.7.0.0 should only be used with SMART
19
+ App Launch Guide v2.0.0 or above due to granular scope support
20
+ requirements within this version of US Core.
21
+
22
+ Please select which approved version of each standard to use, and click 'Create
23
+ Test Session' to begin testing.
24
+
25
+ This test kit includes a [simulated conformant FHIR
26
+ API](https://inferno.healthit.gov/reference-server/) that can be used to
27
+ demonstrate success for all tests. This simulated API is open source and is
28
+ available on
29
+ [GitHub](https://github.com/inferno-framework/inferno-reference-server). Visit
30
+ the
31
+ [walkthrough](https://github.com/onc-healthit/onc-certification-g10-test-kit/wiki/Walkthrough)
32
+ for a demonstration of using these tests against the provided simulated FHIR
33
+ API.
34
+
35
+ ## Status
36
+
37
+ The ONC Certification (g)(10) Standardized API is actively developed and updates
38
+ are released monthly.
39
+
40
+ The test kit currently tests all requirements for the [Standardized API for
41
+ Patient and Population Services criterion §
42
+ 170.315(g)(10)](https://www.healthit.gov/test-method/standardized-api-patient-and-population-services),
43
+ including updates from the [HTI-1 Final
44
+ Rule](https://www.healthit.gov/topic/laws-regulation-and-policy/health-data-technology-and-interoperability-certification-program).
45
+ This includes:
46
+ - SMART App Standalone Launch with full system access
47
+ - SMART App Standalone Launch with limited system access
48
+ - SMART App Standalone Launch with OpenID Connect
49
+ - SMART App EHR Launch with user scopes
50
+ - SMART App EHR Launch with patient scopes
51
+ - SMART App Launch Invalid AUD Parameter
52
+ - SMART App Launch Invalid Access Token Request
53
+ - SMART App Launch Token Introspection
54
+ - SMART App Launch v1 and v2 scopes
55
+ - SMART App Launch finer-grained scope access
56
+ - Support for Capability Statement
57
+ - Support for all US Core Profiles
58
+ - Searches required for each resource
59
+ - Support for Must Support Elements
60
+ - Profile Validation
61
+ - Reference Validation
62
+ - Export of multiple patients using the FHIR Bulk Data Access IG
63
+
64
+ See the test descriptions within the test kit for detail on the specific
65
+ validations performed as part of testing these requirements.
66
+
67
+ ## Repository and Resources
68
+
69
+ The ONC Certification (g)(10) Standardized API Test Kit can be [downloaded from
70
+ its GitHub
71
+ repository](https://github.com/onc-healthit/onc-certification-g10-test-kit),
72
+ where additional resources and documentation are also available to help users
73
+ get started with the testing process. The repository
74
+ [Wiki](https://github.com/onc-healthit/onc-certification-g10-test-kit/wiki/FAQ)
75
+ provides a
76
+ [FAQ](https://github.com/onc-healthit/onc-certification-g10-test-kit/wiki/FAQ)
77
+ for testers, and the
78
+ [Releases](https://github.com/onc-healthit/onc-certification-g10-test-kit/releases)
79
+ page provides information about each new release.
80
+
81
+ ## Providing Feedback and Reporting Issues
82
+
83
+ We welcome feedback on the tests, including but not limited to the following areas:
84
+
85
+ - Validation logic, such as potential bugs, lax checks, and unexpected failures.
86
+ - Requirements coverage, such as requirements that have been missed, tests that
87
+ necessitate features that the IG does not require, or other issues with the
88
+ interpretation of the IG's requirements.
89
+ - User experience, such as confusing or missing information in the test UI.
90
+
91
+ Please report any issues with this set of tests in the [issues
92
+ section](https://github.com/onc-healthit/onc-certification-g10-test-kit/issues)
93
+ of the repository.
94
+ DESCRIPTION
95
+ suite_ids [:g10_certification]
96
+ tags ['SMART App Launch', 'US Core', 'Bulk Data']
97
+ last_updated LAST_UPDATED
98
+ version VERSION
99
+ maturity 'High'
100
+ authors ['Stephen MacVicar']
101
+ repo 'https://github.com/onc-healthit/onc-certification-g10-test-kit'
102
+ end
103
+ end
@@ -45,10 +45,6 @@ module ONCCertificationG10TestKit
45
45
  run_as_group
46
46
 
47
47
  input_order :bulk_server_url,
48
- :bulk_token_endpoint,
49
- :bulk_client_id,
50
- :bulk_scope,
51
- :bulk_encryption_method,
52
48
  :group_id,
53
49
  :bulk_patient_ids_in_group,
54
50
  :bulk_device_types_in_group,
@@ -45,16 +45,20 @@ module ONCCertificationG10TestKit
45
45
  run_as_group
46
46
 
47
47
  input_order :bulk_server_url,
48
- :bulk_token_endpoint,
49
- :bulk_client_id,
50
- :bulk_scope,
51
- :bulk_encryption_method,
52
48
  :group_id,
53
49
  :bulk_patient_ids_in_group,
54
50
  :bulk_device_types_in_group,
55
51
  :lines_to_validate,
56
52
  :bulk_timeout
57
53
 
54
+ config(
55
+ inputs: {
56
+ url: {
57
+ name: :bulk_server_url
58
+ }
59
+ }
60
+ )
61
+
58
62
  group from: :bulk_data_authorization,
59
63
  description: <<~DESCRIPTION
60
64
  Bulk Data servers are required to authorize clients using the [Backend Service
@@ -8,15 +8,15 @@ module ONCCertificationG10TestKit
8
8
  )
9
9
  id :g10_patient_context
10
10
  input :patient_id, :url
11
- input :smart_credentials, type: :oauth_credentials
11
+ input :smart_auth_info, type: 'auth_info'
12
12
 
13
13
  fhir_client :authenticated do
14
14
  url :url
15
- oauth_credentials :smart_credentials
15
+ auth_info :smart_auth_info
16
16
  end
17
17
 
18
18
  run do
19
- skip_if smart_credentials.access_token.blank?, 'No access token was received during the SMART launch'
19
+ skip_if smart_auth_info.access_token.blank?, 'No access token was received during the SMART launch'
20
20
 
21
21
  skip_if patient_id.blank?, 'Token response did not contain `patient` field'
22
22
 
@@ -22,7 +22,7 @@ module ONCCertificationG10TestKit
22
22
 
23
23
  run do
24
24
  expected_scopes =
25
- if scope_version == :v2 || scope_version == :v22
25
+ if [:v2, :v22].include?(scope_version)
26
26
  [
27
27
  Regexp.new(scope_regex_string('patient/Patient.rs').gsub('.rs', '.r?s')),
28
28
  Regexp.new(scope_regex_string('patient/Patient.rs').gsub('.rs', '.rs?'))