davinci_crd_test_kit 0.12.0 → 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 +6 -1
  3. data/config/presets/ri_crd_request_generator.json.erb +1 -1
  4. data/lib/davinci_crd_test_kit/client_fhir_api_group.rb +13 -2
  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 +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 127edba8a287013916c1d2253e75adc7f5a294a3f7f728c55eac90f0af98f971
4
- data.tar.gz: 72e7fa073aff5b9883e676eba4cd6fbbf0247c236b17bdb16d1063fcb7ada625
3
+ metadata.gz: e7aa24c2a8102e8bed59aa0048f99c0ef46a75b0f6d1019c089929a73ee72415
4
+ data.tar.gz: ccd3b902a0daff447d42331458c5951f383ce59515d00504f6abb02e63c00342
5
5
  SHA512:
6
- metadata.gz: deb2fe6592efa6eba5f614766f28eb69d5a357ceced62933c5f86a93e2570d7e296c63ca9c3a4434a240f2e7d3f5489b887daee40d36a46587da0732364eb19b
7
- data.tar.gz: '0268515d52e9f623acd3c97ce09acf30c95cadb48eb87361a0bfce939288d6d3038e285bd020647526d542334149caa8bb013511266c07ec2e4305c476f7249b'
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",
@@ -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,9 @@ 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'
44
47
 
45
48
  config(
46
49
  inputs: {
@@ -168,6 +171,8 @@ module DaVinciCRDTestKit
168
171
  * [Task](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#Task1-16)
169
172
  * [VisionPrescription](https://hl7.org/fhir/us/davinci-crd/STU2/CapabilityStatement-crd-client.html#VisionPrescription1-17)
170
173
  )
174
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@43'
175
+
171
176
  input :url
172
177
  input :smart_auth_info,
173
178
  type: :auth_info,
@@ -218,6 +223,7 @@ module DaVinciCRDTestKit
218
223
  Resource Conformance: SHOULD
219
224
  )
220
225
  optional
226
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
221
227
 
222
228
  test from: :crd_client_fhir_api_update_test,
223
229
  optional: true,
@@ -239,8 +245,8 @@ module DaVinciCRDTestKit
239
245
  validate any returned resources against the [CRD Coverage profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-coverage.html)
240
246
 
241
247
  Required Coverage resource FHIR interactions:
242
- * SHALL suport search by [`patient`](http://hl7.org/fhir/R4/coverage.html#search)
243
- * 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)
244
250
 
245
251
  Resource Conformance: SHALL
246
252
  )
@@ -317,6 +323,7 @@ module DaVinciCRDTestKit
317
323
  Resource Conformance: SHOULD
318
324
  )
319
325
  optional
326
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
320
327
 
321
328
  test from: :crd_client_fhir_api_update_test,
322
329
  optional: true,
@@ -594,6 +601,7 @@ module DaVinciCRDTestKit
594
601
  Resource Conformance: SHOULD
595
602
  )
596
603
  optional
604
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
597
605
 
598
606
  test from: :crd_client_fhir_api_update_test,
599
607
  optional: true,
@@ -620,6 +628,7 @@ module DaVinciCRDTestKit
620
628
  Resource Conformance: SHOULD
621
629
  )
622
630
  optional
631
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
623
632
 
624
633
  test from: :crd_client_fhir_api_update_test,
625
634
  optional: true,
@@ -678,6 +687,7 @@ module DaVinciCRDTestKit
678
687
  Resource Conformance: SHOULD
679
688
  )
680
689
  optional
690
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
681
691
 
682
692
  test from: :crd_client_fhir_api_update_test,
683
693
  optional: true,
@@ -756,6 +766,7 @@ module DaVinciCRDTestKit
756
766
  Resource Conformance: SHOULD
757
767
  )
758
768
  optional
769
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@150'
759
770
 
760
771
  test from: :crd_client_fhir_api_update_test,
761
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,
@@ -18,6 +18,7 @@ module DaVinciCRDTestKit
18
18
  contained resource against its corresponding CRD resource profile. This test is optional and will be skipped if no
19
19
  `prefetch` field is contained in the hook request.
20
20
  )
21
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@43'
21
22
  optional
22
23
 
23
24
  input :contexts, :prefetches
@@ -13,10 +13,20 @@ module DaVinciCRDTestKit
13
13
  system action for these hooks, even if the response indicates that further information is needed or that the
14
14
  level of detail provided is insufficient to determine coverage.
15
15
  )
16
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@164', 'hl7.fhir.us.davinci-crd_2.0.1@205',
17
+ 'hl7.fhir.us.davinci-crd_2.0.1@207', 'hl7.fhir.us.davinci-crd_2.0.1@243',
18
+ 'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
16
19
 
17
20
  config options: { accepts_multiple_requests: true }
18
21
 
19
- input :iss
22
+ input :cds_jwt_iss,
23
+ title: 'CRD JWT Issuer',
24
+ description: %(
25
+ Value of the `iss` claim that must be sent on the Bearer token in the `Authorization`
26
+ header of all requests. Run or re-run the **Client Registration** group to set or
27
+ change this value.
28
+ ),
29
+ locked: true
20
30
  input :order_dispatch_selected_response_types,
21
31
  title: 'Response types to return from order-dispatch hook requests',
22
32
  description: %(
@@ -73,7 +83,7 @@ module DaVinciCRDTestKit
73
83
 
74
84
  run do
75
85
  wait(
76
- identifier: "order-dispatch #{iss}",
86
+ identifier: "order-dispatch #{cds_jwt_iss}",
77
87
  message: %(
78
88
  **Order Dispatch CDS Service Test**:
79
89
 
@@ -83,7 +93,8 @@ module DaVinciCRDTestKit
83
93
 
84
94
  Inferno will process the requests and return CDS cards if successful.
85
95
 
86
- [Click here](#{resume_pass_url}?token=order-dispatch%20#{iss}) when you have finished submitting requests.
96
+ [Click here](#{resume_pass_url}?token=order-dispatch%20#{cds_jwt_iss}) when you have finished submitting
97
+ requests.
87
98
  )
88
99
  )
89
100
  end