davinci_crd_test_kit 0.11.1 → 0.12.1

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/inferno_crd_server_suite.json.erb +10 -23
  3. data/config/presets/ri_crd_request_generator.json.erb +1 -1
  4. data/lib/davinci_crd_test_kit/client_fhir_api_group.rb +36 -13
  5. data/lib/davinci_crd_test_kit/client_hooks_group.rb +11 -4
  6. data/lib/davinci_crd_test_kit/client_registration_group.rb +26 -0
  7. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +14 -3
  8. data/lib/davinci_crd_test_kit/client_tests/client_appointment_book_group.rb +6 -1
  9. data/lib/davinci_crd_test_kit/client_tests/client_encounter_discharge_group.rb +2 -0
  10. data/lib/davinci_crd_test_kit/client_tests/client_encounter_start_group.rb +3 -0
  11. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_create_test.rb +1 -0
  12. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_search_test.rb +2 -2
  13. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb +1 -0
  14. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_validation_test.rb +1 -1
  15. data/lib/davinci_crd_test_kit/client_tests/client_order_dispatch_group.rb +10 -1
  16. data/lib/davinci_crd_test_kit/client_tests/client_order_select_group.rb +11 -1
  17. data/lib/davinci_crd_test_kit/client_tests/client_order_sign_group.rb +11 -1
  18. data/lib/davinci_crd_test_kit/client_tests/client_registration_verification_test.rb +88 -0
  19. data/lib/davinci_crd_test_kit/client_tests/encounter_discharge_receive_request_test.rb +12 -3
  20. data/lib/davinci_crd_test_kit/client_tests/encounter_start_receive_request_test.rb +13 -3
  21. data/lib/davinci_crd_test_kit/client_tests/hook_request_optional_fields_test.rb +1 -1
  22. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_context_test.rb +1 -0
  23. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_prefetch_test.rb +1 -0
  24. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +14 -3
  25. data/lib/davinci_crd_test_kit/client_tests/order_select_receive_request_test.rb +13 -3
  26. data/lib/davinci_crd_test_kit/client_tests/order_sign_receive_request_test.rb +13 -3
  27. data/lib/davinci_crd_test_kit/client_tests/retrieve_jwks_test.rb +11 -8
  28. data/lib/davinci_crd_test_kit/client_tests/token_payload_test.rb +3 -3
  29. data/lib/davinci_crd_test_kit/crd_client_suite.rb +30 -2
  30. data/lib/davinci_crd_test_kit/hook_request_field_validation.rb +8 -0
  31. data/lib/davinci_crd_test_kit/requirements/davinci-crd-test-kit_out_of_scope_requirements.csv +1 -0
  32. data/lib/davinci_crd_test_kit/requirements/davinci-crd-test-kit_requirements.csv +368 -0
  33. data/lib/davinci_crd_test_kit/requirements/generated/davinci-crd-test-kit_requirements_coverage.csv +366 -0
  34. data/lib/davinci_crd_test_kit/server_appointment_book_group.rb +2 -0
  35. data/lib/davinci_crd_test_kit/server_discovery_group.rb +2 -1
  36. data/lib/davinci_crd_test_kit/server_encounter_discharge_group.rb +1 -0
  37. data/lib/davinci_crd_test_kit/server_encounter_start_group.rb +1 -0
  38. data/lib/davinci_crd_test_kit/server_hooks_group.rb +2 -0
  39. data/lib/davinci_crd_test_kit/server_order_dispatch_group.rb +2 -0
  40. data/lib/davinci_crd_test_kit/server_order_select_group.rb +1 -0
  41. data/lib/davinci_crd_test_kit/server_order_sign_group.rb +2 -0
  42. data/lib/davinci_crd_test_kit/server_required_card_response_validation_group.rb +3 -0
  43. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_received_test.rb +3 -0
  44. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_validation_test.rb +1 -0
  45. data/lib/davinci_crd_test_kit/server_tests/create_or_update_coverage_info_response_validation_test.rb +1 -0
  46. data/lib/davinci_crd_test_kit/server_tests/external_reference_card_validation_test.rb +1 -0
  47. data/lib/davinci_crd_test_kit/server_tests/form_completion_response_validation_test.rb +1 -0
  48. data/lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb +1 -0
  49. data/lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb +3 -3
  50. data/lib/davinci_crd_test_kit/suggestion_actions_validation.rb +1 -1
  51. data/lib/davinci_crd_test_kit/version.rb +2 -2
  52. data/lib/davinci_crd_test_kit.rb +1 -0
  53. data/lib/inferno_requirements_tools/ext/inferno_core/runnable.rb +22 -0
  54. data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +284 -0
  55. data/lib/requirements_config.yaml +18 -0
  56. metadata +12 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 970eb61c1075868a3d84497e1765c2b67c02a8bf61e0005fe0700c4df15984cb
4
- data.tar.gz: 799e551ca2d70bf6ca6ffb539ebd8832ec638c04cdfcc5b3206e58df42d7a86f
3
+ metadata.gz: e7aa24c2a8102e8bed59aa0048f99c0ef46a75b0f6d1019c089929a73ee72415
4
+ data.tar.gz: ccd3b902a0daff447d42331458c5951f383ce59515d00504f6abb02e63c00342
5
5
  SHA512:
6
- metadata.gz: 854c86c38eacd5cca3c40253da23625f9597b317a09ab406e341930a1571018364bca1bc6b61237862b5019491ffb9ac231de11f7bfe17021819a7d68a21f9ef
7
- data.tar.gz: 7f8d00e32b5b10a3fd89f15e1e3eff2369c7fd52e58caf065d47778e19eb509244f36ca385bd1435032f0b96d94e285a9ea754b94b6cce582619c25be5e07d81
6
+ metadata.gz: faa55e1274867c584dec2c5e3c6522b13590c41342eb1e55691e5f5f78ce1208b2d4df7674b0ef1e7ba23ab6bc22ce1226f283ca9c0cc1583d61e668ef80a56d
7
+ data.tar.gz: 1b0d2526904aaf5138cf12d131e7fd769ca05652fb542d0139e9f93abce996edd929336c8f786639cea54bbda75b3c8ae67783ea5bf494a0e182ddde4eab092c
@@ -4,11 +4,16 @@
4
4
  "test_suite_id": "crd_client",
5
5
  "inputs": [
6
6
  {
7
- "name": "iss",
7
+ "name": "cds_jwt_iss",
8
8
  "title": "URI of the issuer of the JWT used to authorize CDS Hooks calls",
9
9
  "type": "text",
10
10
  "value": "<%= Inferno::Application['base_url'] %>/custom/crd_server"
11
11
  },
12
+ {
13
+ "name": "cds_jwk_set",
14
+ "type": "textarea",
15
+ "value": "<%= Inferno::Application['base_url'] %>/custom/crd_server/jwks.json"
16
+ },
12
17
  {
13
18
  "name": "url",
14
19
  "description": "URL of the FHIR endpoint used by SMART applications",
@@ -17,34 +22,16 @@
17
22
  "value": "<%= ENV.fetch('INFERNO_REFERENCE_SERVER_URI', 'https://inferno-qa.healthit.gov') %>/reference-server/r4"
18
23
  },
19
24
  {
20
- "name": "ehr_smart_credentials",
25
+ "name": "smart_auth_info",
21
26
  "optional": true,
22
27
  "title": "OAuth Credentials",
23
- "type": "oauth_credentials",
28
+ "type": "auth_info",
24
29
  "value": {
30
+ "auth_type": "public",
25
31
  "access_token": "SAMPLE_TOKEN",
26
- "refresh_token": "",
27
- "expires_in": "",
28
- "client_id": "",
29
- "client_secret": "",
30
- "token_url": ""
32
+ "client_id": "SAMPLE_PUBLIC_CLIENT_ID"
31
33
  }
32
34
  },
33
- {
34
- "name": "ehr_client_id",
35
- "description": "Client ID provided during registration of Inferno as an EHR launch application",
36
- "title": "EHR Launch Client ID",
37
- "type": "text",
38
- "value": "SAMPLE_PUBLIC_CLIENT_ID"
39
- },
40
- {
41
- "name": "ehr_requested_scopes",
42
- "default": "launch openid fhirUser offline_access user/*.rs",
43
- "description": "OAuth 2.0 scope provided by system to enable all required functionality",
44
- "title": "EHR Launch Scope",
45
- "type": "textarea",
46
- "value": "launch openid fhirUser offline_access user/*.rs"
47
- },
48
35
  {
49
36
  "name": "patient_ids",
50
37
  "description": "Comma separated list of Patient IDs that in sum contain all MUST SUPPORT elements",
@@ -4,7 +4,7 @@
4
4
  "test_suite_id": "crd_client",
5
5
  "inputs": [
6
6
  {
7
- "name": "iss",
7
+ "name": "cds_jwt_iss",
8
8
  "title": "URI of the issuer of the JWT used to authorize CDS Hooks calls",
9
9
  "type": "text",
10
10
  "value": "<%= ENV.fetch('RI_CRD_REQUEST_GENERATOR_URI', 'https://crd-test.davinci.hl7.org') %>/test-ehr/r4"
@@ -41,6 +41,27 @@ module DaVinciCRDTestKit
41
41
  server with Inferno so that Inferno may access resources on the FHIR server in order to perform the FHIR RESTful
42
42
  Capabilities tests.
43
43
  )
44
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@64', 'hl7.fhir.us.davinci-crd_2.0.1@65',
45
+ 'hl7.fhir.us.davinci-crd_2.0.1@66', 'hl7.fhir.us.davinci-crd_2.0.1@89',
46
+ 'hl7.fhir.us.davinci-crd_2.0.1@92'
47
+
48
+ config(
49
+ inputs: {
50
+ smart_auth_info: {
51
+ name: :smart_auth_info,
52
+ title: 'EHR Launch Credentials',
53
+ options: {
54
+ mode: 'auth',
55
+ components: [
56
+ Inferno::DSL::AuthInfo.default_auth_type_component_without_backend_services
57
+ ]
58
+ }
59
+ }
60
+ },
61
+ outputs: {
62
+ smart_auth_info: { name: :smart_auth_info }
63
+ }
64
+ )
44
65
 
45
66
  group from: :smart_discovery do
46
67
  required_suite_options CRDOptions::SMART_1_REQUIREMENT
@@ -107,11 +128,7 @@ module DaVinciCRDTestKit
107
128
  optional
108
129
  config(
109
130
  inputs: {
110
- id_token: { name: :ehr_id_token },
111
- client_id: { name: :ehr_client_id },
112
- requested_scopes: { name: :ehr_requested_scopes },
113
- access_token: { name: :ehr_access_token },
114
- smart_credentials: { name: :ehr_smart_credentials }
131
+ id_token: { name: :ehr_id_token }
115
132
  }
116
133
  )
117
134
  end
@@ -121,9 +138,6 @@ module DaVinciCRDTestKit
121
138
  optional
122
139
  config(
123
140
  inputs: {
124
- refresh_token: { name: :ehr_refresh_token },
125
- client_id: { name: :ehr_client_id },
126
- client_secret: { name: :ehr_client_secret },
127
141
  received_scopes: { name: :ehr_received_scopes }
128
142
  }
129
143
  )
@@ -157,15 +171,18 @@ module DaVinciCRDTestKit
157
171
  * [Task](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Task1-16)
158
172
  * [VisionPrescription](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#VisionPrescription1-17)
159
173
  )
174
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@43'
175
+
160
176
  input :url
161
- input :ehr_smart_credentials,
162
- type: :oauth_credentials,
177
+ input :smart_auth_info,
178
+ type: :auth_info,
163
179
  title: 'OAuth Credentials',
180
+ options: { mode: 'access' },
164
181
  optional: true
165
182
 
166
183
  fhir_client do
167
184
  url :url
168
- oauth_credentials :ehr_smart_credentials
185
+ auth_info :smart_auth_info
169
186
  end
170
187
 
171
188
  group do
@@ -206,6 +223,7 @@ module DaVinciCRDTestKit
206
223
  Resource Conformance: SHOULD
207
224
  )
208
225
  optional
226
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
209
227
 
210
228
  test from: :crd_client_fhir_api_update_test,
211
229
  optional: true,
@@ -227,8 +245,8 @@ module DaVinciCRDTestKit
227
245
  validate any returned resources against the [CRD Coverage profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-coverage.html)
228
246
 
229
247
  Required Coverage resource FHIR interactions:
230
- * SHALL suport search by [`patient`](http://hl7.org/fhir/R4/coverage.html#search)
231
- * SHALL suport search by [`status`](http://hl7.org/fhir/R4/coverage.html#search)
248
+ * SHALL support search by [`patient`](http://hl7.org/fhir/R4/coverage.html#search)
249
+ * SHALL support search by [`status`](http://hl7.org/fhir/R4/coverage.html#search)
232
250
 
233
251
  Resource Conformance: SHALL
234
252
  )
@@ -305,6 +323,7 @@ module DaVinciCRDTestKit
305
323
  Resource Conformance: SHOULD
306
324
  )
307
325
  optional
326
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
308
327
 
309
328
  test from: :crd_client_fhir_api_update_test,
310
329
  optional: true,
@@ -582,6 +601,7 @@ module DaVinciCRDTestKit
582
601
  Resource Conformance: SHOULD
583
602
  )
584
603
  optional
604
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
585
605
 
586
606
  test from: :crd_client_fhir_api_update_test,
587
607
  optional: true,
@@ -608,6 +628,7 @@ module DaVinciCRDTestKit
608
628
  Resource Conformance: SHOULD
609
629
  )
610
630
  optional
631
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
611
632
 
612
633
  test from: :crd_client_fhir_api_update_test,
613
634
  optional: true,
@@ -666,6 +687,7 @@ module DaVinciCRDTestKit
666
687
  Resource Conformance: SHOULD
667
688
  )
668
689
  optional
690
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
669
691
 
670
692
  test from: :crd_client_fhir_api_update_test,
671
693
  optional: true,
@@ -744,6 +766,7 @@ module DaVinciCRDTestKit
744
766
  Resource Conformance: SHOULD
745
767
  )
746
768
  optional
769
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
747
770
 
748
771
  test from: :crd_client_fhir_api_update_test,
749
772
  optional: true,
@@ -41,11 +41,18 @@ module DaVinciCRDTestKit
41
41
  the patient provided in the service request.
42
42
  DESCRIPTION
43
43
  id :crd_client_hooks
44
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@149'
44
45
 
45
- input :iss,
46
- title: 'JWT Issuer',
47
- description: 'The `iss` claim of the JWT in the Authorization header ' \
48
- 'will be used to associate incoming requests with this test session'
46
+ input :cds_jwt_iss,
47
+ title: 'CRD JWT Issuer',
48
+ description: %(
49
+ Value of the `iss` claim that must be sent on the Bearer token in the `Authorization`
50
+ header of all requests. Run or re-run the **Client Registration** group to set or
51
+ change this value.
52
+ ),
53
+ locked: true
54
+
55
+ input_order :cds_jwt_iss, :cds_jwk_set
49
56
 
50
57
  group from: :crd_client_appointment_book,
51
58
  optional: true
@@ -0,0 +1,26 @@
1
+ require_relative 'client_tests/client_registration_verification_test'
2
+
3
+ module DaVinciCRDTestKit
4
+ class PASClientRegistrationGroup < Inferno::TestGroup
5
+ id :crd_client_registration
6
+ title 'Client Registration'
7
+ description %(
8
+ Register the CRD client under test with Inferno's simulated CRD Server by
9
+ providing required information for Inferno to use in identifying and verify
10
+ hook requests.
11
+
12
+ Testers will be required to provide:
13
+ 1. The `iss` URI that uniquely identifies this CRD client to Inferno.
14
+ 2. The CRD client's JSON Web Key (JWK) Set in the form of either a URL
15
+ that resolves to a valid JWK Set or the literal JWK Set in JSON form.
16
+
17
+ Inferno will verify these values and use them for the remainder of the tests.
18
+ These tests must be run before any other tests as they represent the registration
19
+ of the client under test with the Inferno service. If the client needs to make a
20
+ change to its registered values during execution, this test will need to be re-run.
21
+ )
22
+ run_as_group
23
+
24
+ test from: :crd_client_registration_verification
25
+ end
26
+ end
@@ -14,8 +14,18 @@ module DaVinciCRDTestKit
14
14
  level of detail provided is insufficient to determine coverage.
15
15
  )
16
16
  config options: { accepts_multiple_requests: true }
17
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@164', 'hl7.fhir.us.davinci-crd_2.0.1@171',
18
+ 'hl7.fhir.us.davinci-crd_2.0.1@183', 'hl7.fhir.us.davinci-crd_2.0.1@243',
19
+ 'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
17
20
 
18
- input :iss
21
+ input :cds_jwt_iss,
22
+ title: 'CRD JWT Issuer',
23
+ description: %(
24
+ Value of the `iss` claim that must be sent on the Bearer token in the `Authorization`
25
+ header of all requests. Run or re-run the **Client Registration** group to set or
26
+ change this value.
27
+ ),
28
+ locked: true
19
29
  input :appointment_book_selected_response_types,
20
30
  title: 'Response types to return from appointment-book hook requests',
21
31
  description: %(
@@ -64,7 +74,7 @@ module DaVinciCRDTestKit
64
74
 
65
75
  run do
66
76
  wait(
67
- identifier: "appointment-book #{iss}",
77
+ identifier: "appointment-book #{cds_jwt_iss}",
68
78
  message: %(
69
79
  **Appointment Book CDS Service Test**:
70
80
 
@@ -74,7 +84,8 @@ module DaVinciCRDTestKit
74
84
 
75
85
  Inferno will process the requests and return CDS cards if successful.
76
86
 
77
- [Click here](#{resume_pass_url}?token=appointment-book%20#{iss}) when you have finished submitting requests.
87
+ [Click here](#{resume_pass_url}?token=appointment-book%20#{cds_jwt_iss}) when you have finished
88
+ submitting requests.
78
89
  )
79
90
  )
80
91
  end
@@ -25,9 +25,12 @@ module DaVinciCRDTestKit
25
25
 
26
26
  This version of the CRD implementation guide refers to version 1.0 of the hook.
27
27
  DESCRIPTION
28
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@172'
28
29
 
29
30
  run_as_group
30
31
 
32
+ input_order :cds_jwt_iss, :cds_jwk_set
33
+
31
34
  config(
32
35
  inputs: {
33
36
  auth_token_headers_json: { name: :appointment_book_auth_token_headers_json },
@@ -63,7 +66,9 @@ module DaVinciCRDTestKit
63
66
  test from: :crd_token_payload
64
67
  test from: :crd_hook_request_required_fields
65
68
  test from: :crd_hook_request_optional_fields
66
- test from: :crd_hook_request_valid_context
69
+ test from: :crd_hook_request_valid_context do
70
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@71', 'hl7.fhir.us.davinci-crd_2.0.1@286'
71
+ end
67
72
  test from: :crd_hook_request_valid_prefetch
68
73
  test from: :crd_card_display_attest_test
69
74
  end
@@ -29,6 +29,8 @@ module DaVinciCRDTestKit
29
29
 
30
30
  run_as_group
31
31
 
32
+ input_order :cds_jwt_iss, :cds_jwk_set
33
+
32
34
  config(
33
35
  inputs: {
34
36
  auth_token_headers_json: { name: :encounter_discharge_auth_token_headers_json },
@@ -25,9 +25,12 @@ module DaVinciCRDTestKit
25
25
 
26
26
  This version of the CRD implementation guide refers to version 1.0 of the hook.
27
27
  DESCRIPTION
28
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@187'
28
29
 
29
30
  run_as_group
30
31
 
32
+ input_order :cds_jwt_iss, :cds_jwk_set
33
+
31
34
  config(
32
35
  inputs: {
33
36
  auth_token_headers_json: { name: :encounter_start_auth_token_headers_json },
@@ -6,6 +6,7 @@ module DaVinciCRDTestKit
6
6
  Verify that the CRD client supports the create interaction for the given resource. The capabilities required
7
7
  by each resource can be found here: https://hl7.org/fhir/us/davinci-crd/CapabilityStatement-crd-client.html#resourcesSummary1
8
8
  )
9
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@74'
9
10
 
10
11
  input :create_resources,
11
12
  type: 'textarea',
@@ -24,7 +24,7 @@ module DaVinciCRDTestKit
24
24
  ['organization_include', 'practitioner_include', 'location_include']
25
25
  end
26
26
 
27
- def reference_search_paramaters
27
+ def reference_search_parameters
28
28
  ['organization', 'practitioner', 'patient']
29
29
  end
30
30
 
@@ -209,7 +209,7 @@ module DaVinciCRDTestKit
209
209
  if search_type == '_id'
210
210
  bundle = perform_fhir_search({ _id: search_id }, [resource_type, 'id_search'])
211
211
  id_search_result_check(bundle, search_id)
212
- elsif reference_search_paramaters.include?(search_type)
212
+ elsif reference_search_parameters.include?(search_type)
213
213
  search_params = {}
214
214
  search_params[search_type] = search_id
215
215
  bundle = perform_fhir_search(search_params, [resource_type, "#{search_type}_search"])
@@ -6,6 +6,7 @@ module DaVinciCRDTestKit
6
6
  Verify that the CRD client supports the update interaction for the given resource. The capabilities required by
7
7
  each resource can be found here: https://hl7.org/fhir/us/davinci-crd/CapabilityStatement-crd-client.html#resourcesSummary1
8
8
  )
9
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@74'
9
10
 
10
11
  input :update_resources,
11
12
  type: 'textarea',
@@ -4,7 +4,7 @@ module DaVinciCRDTestKit
4
4
  title 'FHIR Resource Validation'
5
5
  description %(
6
6
  Verify that the given resources returned from the previous client API interactions are valid resources. Each
7
- resource is validated against its corresponding [CRD resorce profile](https://hl7.org/fhir/us/davinci-crd/STU2/artifacts.html).
7
+ resource is validated against its corresponding [CRD resource profile](https://hl7.org/fhir/us/davinci-crd/STU2/artifacts.html).
8
8
  )
9
9
 
10
10
  def resource_type
@@ -28,6 +28,8 @@ module DaVinciCRDTestKit
28
28
 
29
29
  run_as_group
30
30
 
31
+ input_order :cds_jwt_iss, :cds_jwk_set
32
+
31
33
  config(
32
34
  inputs: {
33
35
  auth_token_headers_json: { name: :order_dispatch_auth_token_headers_json },
@@ -63,7 +65,14 @@ module DaVinciCRDTestKit
63
65
  test from: :crd_token_payload
64
66
  test from: :crd_hook_request_required_fields
65
67
  test from: :crd_hook_request_optional_fields
66
- test from: :crd_hook_request_valid_context
68
+ test from: :crd_hook_request_valid_context do
69
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@284', 'hl7.fhir.us.davinci-crd_2.0.1@285',
70
+ 'hl7.fhir.us.davinci-crd_2.0.1@286', 'hl7.fhir.us.davinci-crd_2.0.1@287',
71
+ 'hl7.fhir.us.davinci-crd_2.0.1@288', 'hl7.fhir.us.davinci-crd_2.0.1@289',
72
+ 'hl7.fhir.us.davinci-crd_2.0.1@290', 'hl7.fhir.us.davinci-crd_2.0.1@291',
73
+ 'hl7.fhir.us.davinci-crd_2.0.1@292', 'hl7.fhir.us.davinci-crd_2.0.1@293',
74
+ 'hl7.fhir.us.davinci-crd_2.0.1@294', 'hl7.fhir.us.davinci-crd_2.0.1@295'
75
+ end
67
76
  test from: :crd_hook_request_valid_prefetch
68
77
  test from: :crd_card_display_attest_test
69
78
  end
@@ -30,6 +30,8 @@ module DaVinciCRDTestKit
30
30
 
31
31
  run_as_group
32
32
 
33
+ input_order :cds_jwt_iss, :cds_jwk_set
34
+
33
35
  config(
34
36
  inputs: {
35
37
  auth_token_headers_json: { name: :order_select_auth_token_headers_json },
@@ -65,7 +67,15 @@ module DaVinciCRDTestKit
65
67
  test from: :crd_token_payload
66
68
  test from: :crd_hook_request_required_fields
67
69
  test from: :crd_hook_request_optional_fields
68
- test from: :crd_hook_request_valid_context
70
+ test from: :crd_hook_request_valid_context do
71
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@71', 'hl7.fhir.us.davinci-crd_2.0.1@284',
72
+ 'hl7.fhir.us.davinci-crd_2.0.1@285', 'hl7.fhir.us.davinci-crd_2.0.1@286',
73
+ 'hl7.fhir.us.davinci-crd_2.0.1@287', 'hl7.fhir.us.davinci-crd_2.0.1@288',
74
+ 'hl7.fhir.us.davinci-crd_2.0.1@289', 'hl7.fhir.us.davinci-crd_2.0.1@290',
75
+ 'hl7.fhir.us.davinci-crd_2.0.1@291', 'hl7.fhir.us.davinci-crd_2.0.1@292',
76
+ 'hl7.fhir.us.davinci-crd_2.0.1@293', 'hl7.fhir.us.davinci-crd_2.0.1@294',
77
+ 'hl7.fhir.us.davinci-crd_2.0.1@295'
78
+ end
69
79
  test from: :crd_hook_request_valid_prefetch
70
80
  test from: :crd_card_display_attest_test
71
81
  end
@@ -29,6 +29,8 @@ module DaVinciCRDTestKit
29
29
 
30
30
  run_as_group
31
31
 
32
+ input_order :cds_jwt_iss, :cds_jwk_set
33
+
32
34
  config(
33
35
  inputs: {
34
36
  auth_token_headers_json: { name: :order_sign_auth_token_headers_json },
@@ -64,7 +66,15 @@ module DaVinciCRDTestKit
64
66
  test from: :crd_token_payload
65
67
  test from: :crd_hook_request_required_fields
66
68
  test from: :crd_hook_request_optional_fields
67
- test from: :crd_hook_request_valid_context
69
+ test from: :crd_hook_request_valid_context do
70
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@71', 'hl7.fhir.us.davinci-crd_2.0.1@284',
71
+ 'hl7.fhir.us.davinci-crd_2.0.1@285', 'hl7.fhir.us.davinci-crd_2.0.1@286',
72
+ 'hl7.fhir.us.davinci-crd_2.0.1@287', 'hl7.fhir.us.davinci-crd_2.0.1@288',
73
+ 'hl7.fhir.us.davinci-crd_2.0.1@289', 'hl7.fhir.us.davinci-crd_2.0.1@290',
74
+ 'hl7.fhir.us.davinci-crd_2.0.1@291', 'hl7.fhir.us.davinci-crd_2.0.1@292',
75
+ 'hl7.fhir.us.davinci-crd_2.0.1@293', 'hl7.fhir.us.davinci-crd_2.0.1@294',
76
+ 'hl7.fhir.us.davinci-crd_2.0.1@295'
77
+ end
68
78
  test from: :crd_hook_request_valid_prefetch
69
79
  test from: :crd_card_display_attest_test
70
80
  end
@@ -0,0 +1,88 @@
1
+ require 'jwt'
2
+
3
+ module DaVinciCRDTestKit
4
+ class CRDClientRegistrationVerification < Inferno::Test
5
+ include URLs
6
+
7
+ id :crd_client_registration_verification
8
+ title 'Verify CRD Client Registration'
9
+ description %(
10
+ During this test, Inferno will verify that the CRD Client registration details
11
+ provided are conformant.
12
+ )
13
+ input :cds_jwt_iss,
14
+ title: 'CRD JWT Issuer',
15
+ description: %(
16
+ The `iss` claim of the JWT in the Authorization header sent by the CRD client under test on
17
+ all CRD requests. This value will be used to associate incoming requests with this test
18
+ session and any requests that use a different `iss` value will not be recognized.
19
+ ),
20
+ type: 'text'
21
+ input :cds_jwk_set,
22
+ title: 'CRD JSON Web Key Set (JWKS)',
23
+ type: 'textarea',
24
+ description: %(
25
+ The CRD client's JWK Set containing it's public key. May be either
26
+ a publicly accessible url containing the JWKS, or the raw JWKS.
27
+ This input is required for these tests to pass.
28
+ ),
29
+ optional: true
30
+
31
+ run do
32
+ assert cds_jwk_set.present?, 'Provide a jwk set in the **CRD JSON Web Key Set (JWKS)** input.'
33
+
34
+ jwks_warnings = []
35
+ parsed_jwk_set = jwk_set(cds_jwk_set, jwks_warnings)
36
+ jwks_warnings.each { |warning| add_message('warning', warning) }
37
+
38
+ assert parsed_jwk_set.length.positive?, 'JWKS content does not include any valid keys.'
39
+
40
+ assert messages.none? { |msg| msg[:type] == 'error' }, 'Invalid key set provided. See messages for details'
41
+ end
42
+
43
+ def jwk_set(jku, warning_messages = []) # rubocop:disable Metrics/CyclomaticComplexity
44
+ jwk_set = JWT::JWK::Set.new
45
+
46
+ if jku.blank?
47
+ warning_messages << 'No key set input.'
48
+ return jwk_set
49
+ end
50
+
51
+ jwk_body = # try as raw jwk set
52
+ begin
53
+ JSON.parse(jku)
54
+ rescue JSON::ParserError
55
+ nil
56
+ end
57
+
58
+ if jwk_body.blank?
59
+ retrieved = Faraday.get(jku) # try as url pointing to a jwk set
60
+ jwk_body =
61
+ begin
62
+ JSON.parse(retrieved.body)
63
+ rescue JSON::ParserError
64
+ warning_messages << "Failed to fetch valid json from jwks uri #{jku}."
65
+ nil
66
+ end
67
+ else
68
+ warning_messages << 'Providing the JWK Set directly is strongly discouraged.'
69
+ end
70
+
71
+ return jwk_set if jwk_body.blank?
72
+
73
+ jwk_body['keys']&.each_with_index do |key_hash, index|
74
+ parsed_key =
75
+ begin
76
+ JWT::JWK.new(key_hash)
77
+ rescue JWT::JWKError => e
78
+ id = key_hash['kid'] | index
79
+ warning_messages << "Key #{id} invalid: #{e}"
80
+ nil
81
+ end
82
+ jwk_set << parsed_key unless parsed_key.blank?
83
+ end
84
+
85
+ jwk_set
86
+ end
87
+ end
88
+ end
@@ -10,10 +10,19 @@ module DaVinciCRDTestKit
10
10
  This test waits for multiple incoming [encounter-discharge](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge)
11
11
  hook requests and responds to the client with the response types selected as an input.
12
12
  )
13
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@197', 'hl7.fhir.us.davinci-crd_2.0.1@243',
14
+ 'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
13
15
 
14
16
  config options: { accepts_multiple_requests: true }
15
17
 
16
- input :iss
18
+ input :cds_jwt_iss,
19
+ title: 'CRD JWT Issuer',
20
+ description: %(
21
+ Value of the `iss` claim that must be sent on the Bearer token in the `Authorization`
22
+ header of all requests. Run or re-run the **Client Registration** group to set or
23
+ change this value.
24
+ ),
25
+ locked: true
17
26
  input :encounter_discharge_selected_response_types,
18
27
  title: 'Response types to return from encounter-discharge hook requests',
19
28
  description: %(
@@ -62,7 +71,7 @@ module DaVinciCRDTestKit
62
71
 
63
72
  run do
64
73
  wait(
65
- identifier: "encounter-discharge #{iss}",
74
+ identifier: "encounter-discharge #{cds_jwt_iss}",
66
75
  message: %(
67
76
  **Encounter Discharge CDS Service Test**:
68
77
 
@@ -72,7 +81,7 @@ module DaVinciCRDTestKit
72
81
 
73
82
  Inferno will process the requests and return CDS cards if successful.
74
83
 
75
- [Click here](#{resume_pass_url}?token=encounter-discharge%20#{iss}) when you have finished submitting
84
+ [Click here](#{resume_pass_url}?token=encounter-discharge%20#{cds_jwt_iss}) when you have finished submitting
76
85
  requests.
77
86
  )
78
87
  )
@@ -10,10 +10,19 @@ module DaVinciCRDTestKit
10
10
  This test waits for multiple incoming [encounter-start](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-start)
11
11
  hook requests and responds to the client with the response types selected as an input.
12
12
  )
13
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@186', 'hl7.fhir.us.davinci-crd_2.0.1@243',
14
+ 'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
13
15
 
14
16
  config options: { accepts_multiple_requests: true }
15
17
 
16
- input :iss
18
+ input :cds_jwt_iss,
19
+ title: 'CRD JWT Issuer',
20
+ description: %(
21
+ Value of the `iss` claim that must be sent on the Bearer token in the `Authorization`
22
+ header of all requests. Run or re-run the **Client Registration** group to set or
23
+ change this value.
24
+ ),
25
+ locked: true
17
26
  input :encounter_start_selected_response_types,
18
27
  title: 'Response types to return from encounter-start hook requests',
19
28
  description: %(
@@ -62,7 +71,7 @@ module DaVinciCRDTestKit
62
71
 
63
72
  run do
64
73
  wait(
65
- identifier: "encounter-start #{iss}",
74
+ identifier: "encounter-start #{cds_jwt_iss}",
66
75
  message: %(
67
76
  **Encounter Start CDS Service Test**:
68
77
 
@@ -72,7 +81,8 @@ module DaVinciCRDTestKit
72
81
 
73
82
  Inferno will process the requests and return CDS cards if successful.
74
83
 
75
- [Click here](#{resume_pass_url}?token=enounter-start%20#{iss}) when you have finished submitting requests.
84
+ [Click here](#{resume_pass_url}?token=enounter-start%20#{cds_jwt_iss}) when you have finished submitting
85
+ requests.
76
86
  )
77
87
  )
78
88
  end
@@ -15,7 +15,7 @@ module DaVinciCRDTestKit
15
15
  * `fhirAuthorization` - *object*
16
16
  * `prefetch` - *object*
17
17
 
18
- This test checks for the precense of these fields and if they are of the correct type. This test is optional and
18
+ This test checks for the presence of these fields and if they are of the correct type. This test is optional and
19
19
  will not fail if the hook request does not contain an optional field, it only produces an informational message.
20
20
  If the client provides its FHIR server URL in the `fhirServer` field, and it's authorization token in the
21
21
  `fhirAuthorization` field object, they will be produced as an output from this test to be used in
@@ -34,6 +34,7 @@ module DaVinciCRDTestKit
34
34
  The client must provide its FHIR server URL and access token in the hook request in order to run
35
35
  this test.
36
36
  )
37
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@254'
37
38
 
38
39
  input :contexts, :client_fhir_server
39
40
  input :client_access_token,