davinci_crd_test_kit 0.13.0 → 0.14.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 (341) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/inferno_crd_client_suite.json.erb +20 -14
  3. data/config/presets/inferno_crd_client_suite_prefetch_subset_v221.json.erb +125 -0
  4. data/config/presets/inferno_crd_client_suite_v221.json.erb +124 -0
  5. data/config/presets/inferno_crd_server_suite.json.erb +58 -1
  6. data/config/presets/inferno_crd_server_suite_v221.json.erb +94 -0
  7. data/config/presets/ri_crd_request_generator.json_v221.json.erb +13 -0
  8. data/config/presets/ri_crd_server.json.erb +19 -19
  9. data/lib/davinci_crd_test_kit/client/client_base_urls.rb +80 -0
  10. data/lib/davinci_crd_test_kit/{client_hook_request_validation.rb → client/client_hook_request_validation.rb} +1 -1
  11. data/lib/davinci_crd_test_kit/client/crd_client_options.rb +30 -0
  12. data/lib/davinci_crd_test_kit/client/endpoints/cds_services_discovery_handler.rb +34 -0
  13. data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +342 -0
  14. data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +410 -0
  15. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +233 -0
  16. data/lib/davinci_crd_test_kit/{mock_service_response.rb → client/endpoints/mock_service_response.rb} +165 -59
  17. data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/companions_prerequisites.json +1 -0
  18. data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/create_update_coverage_information.json +3 -2
  19. data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/launch_smart_app.json +8 -1
  20. data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/propose_alternate_request.json +1 -0
  21. data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/request_form_completion.json +17 -16
  22. data/lib/davinci_crd_test_kit/client/multi_request_message_helper.rb +35 -0
  23. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +38 -0
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/api/client_fhir_api_create_test.rb +43 -0
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/api/client_fhir_api_read_test.rb +43 -0
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/api/client_fhir_api_search_test.rb +234 -0
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/api/client_fhir_api_update_test.rb +43 -0
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/api/client_fhir_api_validation_test.rb +63 -0
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/decode_auth_token_test.rb +65 -0
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +109 -0
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_header_test.rb +70 -0
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +85 -0
  33. data/lib/davinci_crd_test_kit/{routes/cds-services.json → client/v2.0.1/cds-services-v201.json} +1 -1
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/client_appointment_book_group.rb +108 -0
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/client_card_must_support_group.rb +31 -0
  36. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_discharge_group.rb +105 -0
  37. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_start_group.rb +105 -0
  38. data/lib/davinci_crd_test_kit/client/v2.0.1/client_fhir_api_group.rb +790 -0
  39. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +74 -0
  40. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_dispatch_group.rb +111 -0
  41. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_select_group.rb +116 -0
  42. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_sign_group.rb +113 -0
  43. data/lib/davinci_crd_test_kit/{client_registration_group.rb → client/v2.0.1/client_registration_group.rb} +12 -8
  44. data/lib/davinci_crd_test_kit/client/v2.0.1/client_urls.rb +13 -0
  45. data/lib/davinci_crd_test_kit/client/v2.0.1/crd_client_suite.rb +134 -0
  46. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/appointment_book_receive_request_test.rb +129 -0
  47. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_discharge_receive_request_test.rb +126 -0
  48. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_start_receive_request_test.rb +126 -0
  49. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_dispatch_receive_request_test.rb +138 -0
  50. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_select_receive_request_test.rb +134 -0
  51. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_sign_receive_request_test.rb +136 -0
  52. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_coverage_information.rb +93 -0
  53. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_external_reference.rb +62 -0
  54. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_instructions.rb +62 -0
  55. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_registration_verification_test.rb +94 -0
  56. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_service_registration_attestation_test.rb +40 -0
  57. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_fetched_data_test.rb +86 -0
  58. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_optional_fields_test.rb +63 -0
  59. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_prefetch_equals_queried_test.rb +96 -0
  60. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_required_fields_test.rb +55 -0
  61. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_valid_context_test.rb +70 -0
  62. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_valid_prefetch_test.rb +62 -0
  63. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +83 -0
  64. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +79 -0
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +212 -0
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_crd_update_verification_group.rb +18 -0
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +69 -0
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +120 -0
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_header_test.rb +92 -0
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +93 -0
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +198 -0
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +202 -0
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +102 -0
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +28 -0
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +96 -0
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +95 -0
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +88 -0
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +64 -0
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +32 -0
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +101 -0
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +102 -0
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +107 -0
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +27 -0
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/client_urls.rb +27 -0
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +229 -0
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +63 -0
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +60 -0
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +45 -0
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +135 -0
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +103 -0
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +156 -0
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +157 -0
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +157 -0
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +165 -0
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +165 -0
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +165 -0
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +64 -0
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +49 -0
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_registration_verification_test.rb +161 -0
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +107 -0
  101. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +47 -0
  102. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +152 -0
  103. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +55 -0
  104. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +123 -0
  105. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +127 -0
  106. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +55 -0
  107. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +54 -0
  108. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +48 -0
  109. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +74 -0
  110. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +30 -0
  111. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +77 -0
  112. data/lib/davinci_crd_test_kit/cross_suite/base_urls.rb +20 -0
  113. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +312 -0
  114. data/lib/davinci_crd_test_kit/{cards_validation.rb → cross_suite/cards_validation.rb} +104 -47
  115. data/lib/davinci_crd_test_kit/cross_suite/coverage-information_stu201_metadata.yml +27 -0
  116. data/lib/davinci_crd_test_kit/cross_suite/coverage-information_stu221_metadata.yml +60 -0
  117. data/lib/davinci_crd_test_kit/cross_suite/fhirpath_on_cds_request.rb +177 -0
  118. data/lib/davinci_crd_test_kit/{hook_request_field_validation.rb → cross_suite/hook_request_field_validation.rb} +282 -203
  119. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +220 -0
  120. data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +462 -0
  121. data/lib/davinci_crd_test_kit/cross_suite/prefetch_contents_validation.rb +81 -0
  122. data/lib/davinci_crd_test_kit/cross_suite/prefetch_profile_validation.rb +48 -0
  123. data/lib/davinci_crd_test_kit/cross_suite/profiles_and_resource_types.rb +63 -0
  124. data/lib/davinci_crd_test_kit/cross_suite/replace_tokens.rb +38 -0
  125. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +202 -0
  126. data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +274 -0
  127. data/lib/davinci_crd_test_kit/{suggestion_actions_validation.rb → cross_suite/suggestion_actions_validation.rb} +70 -50
  128. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +42 -0
  129. data/lib/davinci_crd_test_kit/metadata.rb +10 -44
  130. data/lib/davinci_crd_test_kit/requirements/cds-hooks-library_1.0.1_requirements.xlsx +0 -0
  131. data/lib/davinci_crd_test_kit/requirements/cds-hooks_2.0_requirements.xlsx +0 -0
  132. data/lib/davinci_crd_test_kit/requirements/cds-hooks_3.0.0-ballot_requirements.xlsx +0 -0
  133. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +742 -65
  134. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +279 -54
  135. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +1430 -0
  136. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +36 -45
  137. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +143 -0
  138. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.0.1_requirements.xlsx +0 -0
  139. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  140. data/lib/davinci_crd_test_kit/server/endpoints/jwk_set_endpoint_handler.rb +13 -0
  141. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_create_endpoint.rb +23 -0
  142. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_delete_endpoint.rb +30 -0
  143. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_metadata_endpoint.rb +112 -0
  144. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_read_endpoint.rb +21 -0
  145. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_request_handler.rb +261 -0
  146. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_search_endpoint.rb +561 -0
  147. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_update_endpoint.rb +24 -0
  148. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/stress-test-Bundle.json +54687 -0
  149. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr_endpoints.rb +95 -0
  150. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook.rb +225 -0
  151. data/lib/davinci_crd_test_kit/{jwt_helper.rb → server/jwt_helper.rb} +1 -12
  152. data/lib/davinci_crd_test_kit/server/resource_extractor.rb +68 -0
  153. data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +165 -0
  154. data/lib/davinci_crd_test_kit/server/server_base_urls.rb +30 -0
  155. data/lib/davinci_crd_test_kit/{server_hook_helper.rb → server/server_hook_helper.rb} +1 -1
  156. data/lib/davinci_crd_test_kit/{server_hook_request_validation.rb → server/server_hook_request_validation.rb} +1 -1
  157. data/lib/davinci_crd_test_kit/{test_helper.rb → server/server_test_helper.rb} +7 -3
  158. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Appointment.yml +5 -0
  159. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/ClaimResponse.yml +5 -0
  160. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/CommunicationRequest.yml +5 -0
  161. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Coverage.yml +21 -0
  162. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Device.yml +5 -0
  163. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/DeviceRequest.yml +5 -0
  164. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Encounter.yml +7 -0
  165. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Location.yml +5 -0
  166. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/MedicationRequest.yml +5 -0
  167. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/NutritionOrder.yml +5 -0
  168. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Organization.yml +5 -0
  169. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Patient.yml +5 -0
  170. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Practitioner.yml +5 -0
  171. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/PractitionerRole.yml +40 -0
  172. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/ServiceRequest.yml +5 -0
  173. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/Task.yml +5 -0
  174. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_metadata/VisionPrescription.yml +5 -0
  175. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_server_suite.rb +99 -0
  176. data/lib/davinci_crd_test_kit/server/v2.0.1/discovery/discovery_endpoint_test.rb +90 -0
  177. data/lib/davinci_crd_test_kit/server/v2.0.1/discovery/discovery_services_validation_test.rb +67 -0
  178. data/lib/davinci_crd_test_kit/server/v2.0.1/interaction/server_invoke_hook_test.rb +12 -0
  179. data/lib/davinci_crd_test_kit/server/v2.0.1/must_support/coverage_information_system_action_across_hooks_validation_test.rb +34 -0
  180. data/lib/davinci_crd_test_kit/server/v2.0.1/must_support/external_reference_card_across_hooks_validation_test.rb +30 -0
  181. data/lib/davinci_crd_test_kit/server/v2.0.1/must_support/instructions_card_received_across_hooks_test.rb +27 -0
  182. data/lib/davinci_crd_test_kit/server/v2.0.1/server_appointment_book_group.rb +191 -0
  183. data/lib/davinci_crd_test_kit/server/v2.0.1/server_demonstrate_hook_response_group.rb +93 -0
  184. data/lib/davinci_crd_test_kit/server/v2.0.1/server_discovery_group.rb +62 -0
  185. data/lib/davinci_crd_test_kit/server/v2.0.1/server_encounter_discharge_group.rb +186 -0
  186. data/lib/davinci_crd_test_kit/server/v2.0.1/server_encounter_start_group.rb +186 -0
  187. data/lib/davinci_crd_test_kit/server/v2.0.1/server_hooks_group.rb +73 -0
  188. data/lib/davinci_crd_test_kit/server/v2.0.1/server_order_dispatch_group.rb +191 -0
  189. data/lib/davinci_crd_test_kit/server/v2.0.1/server_order_select_group.rb +211 -0
  190. data/lib/davinci_crd_test_kit/server/v2.0.1/server_order_sign_group.rb +216 -0
  191. data/lib/davinci_crd_test_kit/server/v2.0.1/server_required_card_response_validation_group.rb +28 -0
  192. data/lib/davinci_crd_test_kit/server/v2.0.1/server_urls.rb +13 -0
  193. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_request/service_request_context_validation_test.rb +30 -0
  194. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_request/service_request_optional_fields_validation_test.rb +39 -0
  195. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_request/service_request_required_fields_validation_test.rb +40 -0
  196. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/additional_orders_validation_test.rb +59 -0
  197. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/card_optional_fields_validation_test.rb +51 -0
  198. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/coverage_information_system_action_received_test.rb +65 -0
  199. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/coverage_information_system_action_validation_test.rb +120 -0
  200. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/create_or_update_coverage_info_response_validation_test.rb +70 -0
  201. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/external_reference_card_validation_test.rb +37 -0
  202. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/form_completion_response_validation_test.rb +67 -0
  203. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/instructions_card_received_test.rb +30 -0
  204. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/launch_smart_app_card_validation_test.rb +39 -0
  205. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/propose_alternate_request_card_validation_test.rb +46 -0
  206. data/lib/davinci_crd_test_kit/server/v2.0.1/verify_response/service_response_validation_test.rb +83 -0
  207. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Appointment_withorder.yml +5 -0
  208. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Appointment_withoutorder.yml +5 -0
  209. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/CommunicationRequest.yml +5 -0
  210. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Coverage.yml +5 -0
  211. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Device.yml +5 -0
  212. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/DeviceRequest.yml +5 -0
  213. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Encounter.yml +5 -0
  214. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Location.yml +5 -0
  215. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/MedicationRequest.yml +5 -0
  216. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/NutritionOrder.yml +5 -0
  217. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Organization.yml +5 -0
  218. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/Patient.yml +5 -0
  219. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/PractitionerRole.yml +5 -0
  220. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/ServiceRequest.yml +5 -0
  221. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_metadata/VisionPrescription.yml +5 -0
  222. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_server_suite.rb +115 -0
  223. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_configuration_test.rb +159 -0
  224. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_endpoint_test.rb +90 -0
  225. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_prefetch_support_test.rb +43 -0
  226. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_services_validation_test.rb +121 -0
  227. data/lib/davinci_crd_test_kit/server/v2.2.1/interaction/server_invoke_hook_test.rb +17 -0
  228. data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/coverage_information_must_support_test.rb +71 -0
  229. data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/coverage_information_system_action_across_hooks_validation_test.rb +36 -0
  230. data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/supported_us_core_versions_test.rb +118 -0
  231. data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +213 -0
  232. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +93 -0
  233. data/lib/davinci_crd_test_kit/server/v2.2.1/server_discovery_group.rb +69 -0
  234. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +194 -0
  235. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +194 -0
  236. data/lib/davinci_crd_test_kit/server/v2.2.1/server_hooks_group.rb +73 -0
  237. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +214 -0
  238. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +219 -0
  239. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +241 -0
  240. data/lib/davinci_crd_test_kit/server/v2.2.1/server_required_card_response_validation_group.rb +30 -0
  241. data/lib/davinci_crd_test_kit/server/v2.2.1/server_urls.rb +13 -0
  242. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +30 -0
  243. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_no_custom_extensions_test.rb +120 -0
  244. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +39 -0
  245. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +40 -0
  246. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/additional_orders_validation_test.rb +66 -0
  247. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/all_responses_include_coverage_information_test.rb +123 -0
  248. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/card_optional_fields_validation_test.rb +57 -0
  249. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_info_configuration_test.rb +83 -0
  250. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_received_test.rb +65 -0
  251. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_validation_test.rb +184 -0
  252. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/create_or_update_coverage_info_response_validation_test.rb +75 -0
  253. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/external_reference_card_validation_test.rb +47 -0
  254. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/form_completion_response_validation_test.rb +91 -0
  255. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/hook_request_resource_resolution.rb +137 -0
  256. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/instructions_card_received_test.rb +32 -0
  257. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/launch_smart_app_card_validation_test.rb +49 -0
  258. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/order_dispatch_coverage_information_test.rb +38 -0
  259. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/propose_alternate_request_card_validation_test.rb +54 -0
  260. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb +97 -0
  261. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_cds_hooks_elements_test.rb +78 -0
  262. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_configuration_test.rb +78 -0
  263. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_context_test.rb +78 -0
  264. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/verify_response_without_billing_options_test.rb +43 -0
  265. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/verify_response_without_configuration_test.rb +44 -0
  266. data/lib/davinci_crd_test_kit/version.rb +2 -2
  267. data/lib/davinci_crd_test_kit.rb +4 -2
  268. metadata +297 -93
  269. data/lib/davinci_crd_test_kit/client_fhir_api_group.rb +0 -785
  270. data/lib/davinci_crd_test_kit/client_hooks_group.rb +0 -74
  271. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +0 -93
  272. data/lib/davinci_crd_test_kit/client_tests/client_appointment_book_group.rb +0 -75
  273. data/lib/davinci_crd_test_kit/client_tests/client_display_cards_attest.rb +0 -48
  274. data/lib/davinci_crd_test_kit/client_tests/client_encounter_discharge_group.rb +0 -73
  275. data/lib/davinci_crd_test_kit/client_tests/client_encounter_start_group.rb +0 -73
  276. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_create_test.rb +0 -42
  277. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_read_test.rb +0 -40
  278. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_search_test.rb +0 -232
  279. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb +0 -42
  280. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_validation_test.rb +0 -61
  281. data/lib/davinci_crd_test_kit/client_tests/client_order_dispatch_group.rb +0 -79
  282. data/lib/davinci_crd_test_kit/client_tests/client_order_select_group.rb +0 -82
  283. data/lib/davinci_crd_test_kit/client_tests/client_order_sign_group.rb +0 -81
  284. data/lib/davinci_crd_test_kit/client_tests/client_registration_verification_test.rb +0 -88
  285. data/lib/davinci_crd_test_kit/client_tests/decode_auth_token_test.rb +0 -60
  286. data/lib/davinci_crd_test_kit/client_tests/encounter_discharge_receive_request_test.rb +0 -90
  287. data/lib/davinci_crd_test_kit/client_tests/encounter_start_receive_request_test.rb +0 -90
  288. data/lib/davinci_crd_test_kit/client_tests/hook_request_optional_fields_test.rb +0 -57
  289. data/lib/davinci_crd_test_kit/client_tests/hook_request_required_fields_test.rb +0 -49
  290. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_context_test.rb +0 -68
  291. data/lib/davinci_crd_test_kit/client_tests/hook_request_valid_prefetch_test.rb +0 -69
  292. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +0 -102
  293. data/lib/davinci_crd_test_kit/client_tests/order_select_receive_request_test.rb +0 -98
  294. data/lib/davinci_crd_test_kit/client_tests/order_sign_receive_request_test.rb +0 -101
  295. data/lib/davinci_crd_test_kit/client_tests/retrieve_jwks_test.rb +0 -105
  296. data/lib/davinci_crd_test_kit/client_tests/submitted_response_validation.rb +0 -48
  297. data/lib/davinci_crd_test_kit/client_tests/token_header_test.rb +0 -65
  298. data/lib/davinci_crd_test_kit/client_tests/token_payload_test.rb +0 -78
  299. data/lib/davinci_crd_test_kit/crd_client_suite.rb +0 -193
  300. data/lib/davinci_crd_test_kit/crd_options.rb +0 -9
  301. data/lib/davinci_crd_test_kit/crd_server_suite.rb +0 -125
  302. data/lib/davinci_crd_test_kit/igs/davinci-crd-2.0.1.tgz +0 -0
  303. data/lib/davinci_crd_test_kit/routes/cds_services_discovery_handler.rb +0 -18
  304. data/lib/davinci_crd_test_kit/routes/hook_request_endpoint.rb +0 -77
  305. data/lib/davinci_crd_test_kit/routes/jwk_set_endpoint_handler.rb +0 -15
  306. data/lib/davinci_crd_test_kit/server_appointment_book_group.rb +0 -176
  307. data/lib/davinci_crd_test_kit/server_demonstrate_hook_response_group.rb +0 -77
  308. data/lib/davinci_crd_test_kit/server_discovery_group.rb +0 -60
  309. data/lib/davinci_crd_test_kit/server_encounter_discharge_group.rb +0 -170
  310. data/lib/davinci_crd_test_kit/server_encounter_start_group.rb +0 -170
  311. data/lib/davinci_crd_test_kit/server_hooks_group.rb +0 -71
  312. data/lib/davinci_crd_test_kit/server_order_dispatch_group.rb +0 -176
  313. data/lib/davinci_crd_test_kit/server_order_select_group.rb +0 -195
  314. data/lib/davinci_crd_test_kit/server_order_sign_group.rb +0 -201
  315. data/lib/davinci_crd_test_kit/server_required_card_response_validation_group.rb +0 -26
  316. data/lib/davinci_crd_test_kit/server_tests/additional_orders_validation_test.rb +0 -68
  317. data/lib/davinci_crd_test_kit/server_tests/card_optional_fields_validation_test.rb +0 -47
  318. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_across_hooks_validation_test.rb +0 -32
  319. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_received_test.rb +0 -63
  320. data/lib/davinci_crd_test_kit/server_tests/coverage_information_system_action_validation_test.rb +0 -118
  321. data/lib/davinci_crd_test_kit/server_tests/create_or_update_coverage_info_response_validation_test.rb +0 -71
  322. data/lib/davinci_crd_test_kit/server_tests/discovery_endpoint_test.rb +0 -88
  323. data/lib/davinci_crd_test_kit/server_tests/discovery_services_validation_test.rb +0 -65
  324. data/lib/davinci_crd_test_kit/server_tests/external_reference_card_across_hooks_validation_test.rb +0 -28
  325. data/lib/davinci_crd_test_kit/server_tests/external_reference_card_validation_test.rb +0 -36
  326. data/lib/davinci_crd_test_kit/server_tests/form_completion_response_validation_test.rb +0 -78
  327. data/lib/davinci_crd_test_kit/server_tests/instructions_card_received_across_hooks_test.rb +0 -25
  328. data/lib/davinci_crd_test_kit/server_tests/instructions_card_received_test.rb +0 -26
  329. data/lib/davinci_crd_test_kit/server_tests/launch_smart_app_card_validation_test.rb +0 -38
  330. data/lib/davinci_crd_test_kit/server_tests/propose_alternate_request_card_validation_test.rb +0 -63
  331. data/lib/davinci_crd_test_kit/server_tests/service_call_test.rb +0 -101
  332. data/lib/davinci_crd_test_kit/server_tests/service_request_context_validation_test.rb +0 -28
  333. data/lib/davinci_crd_test_kit/server_tests/service_request_optional_fields_validation_test.rb +0 -37
  334. data/lib/davinci_crd_test_kit/server_tests/service_request_required_fields_validation_test.rb +0 -38
  335. data/lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb +0 -81
  336. data/lib/davinci_crd_test_kit/tags.rb +0 -10
  337. data/lib/davinci_crd_test_kit/urls.rb +0 -52
  338. /data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/external_reference.json +0 -0
  339. /data/lib/davinci_crd_test_kit/{card_responses → client/endpoints/mocked_card_responses}/instructions.json +0 -0
  340. /data/lib/davinci_crd_test_kit/{crd_jwks.json → server/endpoints/crd_jwks.json} +0 -0
  341. /data/lib/davinci_crd_test_kit/{jwks.rb → server/endpoints/jwks.rb} +0 -0
@@ -1,98 +0,0 @@
1
- require_relative '../urls'
2
-
3
- module DaVinciCRDTestKit
4
- class OrderSelectReceiveRequestTest < Inferno::Test
5
- include URLs
6
-
7
- id :crd_order_select_request
8
- title 'Request received for order-select hook'
9
- description %(
10
- This test waits for multiple incoming [order-select](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-select)
11
- hook requests and responds to the client with the response types selected as an input.
12
- )
13
- verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@209', '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'
15
-
16
- config options: { accepts_multiple_requests: true }
17
-
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
26
- input :order_select_selected_response_types,
27
- title: 'Response types to return from order-select hook requests',
28
- description: %(
29
- Select the cards/action response types that the Inferno hook request endpoints will return. The default
30
- response type that will be returned for this hook is the `Instructions` card type.
31
- ),
32
- type: 'checkbox',
33
- default: ['coverage_information', 'external_reference', 'instructions'],
34
- optional: true,
35
- options: {
36
- list_options: [
37
- {
38
- label: 'External Reference',
39
- value: 'external_reference'
40
- },
41
- {
42
- label: 'Instructions',
43
- value: 'instructions'
44
- },
45
- {
46
- label: 'Coverage Information',
47
- value: 'coverage_information'
48
- },
49
- {
50
- label: 'Request Form Completion',
51
- value: 'request_form_completion'
52
- },
53
- {
54
- label: 'Create/Update Coverage Information',
55
- value: 'create_update_coverage_info'
56
- },
57
- {
58
- label: 'Launch SMART Application',
59
- value: 'launch_smart_app'
60
- },
61
- {
62
- label: 'Propose Alternate Request',
63
- value: 'propose_alternate_request'
64
- },
65
- {
66
- label: 'Additional Orders as Companions/Prerequisites',
67
- value: 'companions_prerequisites'
68
- }
69
- ]
70
- }
71
- input :order_select_custom_response,
72
- title: 'Custom response for order-select hook requests',
73
- description: %(
74
- A JSON string may be provided here to replace the normal response
75
- from the hook request endpoint
76
- ),
77
- type: 'textarea',
78
- optional: true
79
-
80
- run do
81
- wait(
82
- identifier: "order-select #{cds_jwt_iss}",
83
- message: %(
84
- **Order Select CDS Service Test**:
85
-
86
- Invoke the order-select hook and send requests to:
87
-
88
- `#{order_select_url}`
89
-
90
- Inferno will process the requests and return CDS cards if successful.
91
-
92
- [Click here](#{resume_pass_url}?token=order-select%20#{cds_jwt_iss}) when you have finished submitting
93
- requests.
94
- )
95
- )
96
- end
97
- end
98
- end
@@ -1,101 +0,0 @@
1
- require_relative '../urls'
2
-
3
- module DaVinciCRDTestKit
4
- class OrderSignReceiveRequestTest < Inferno::Test
5
- include URLs
6
-
7
- id :crd_order_sign_request
8
- title 'Request received for order-sign hook'
9
- description %(
10
- This test waits for multiple incoming [order-sign](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-sign)
11
- hook requests and responds to the client with the response types selected as an input. This hook is a 'primary'
12
- hook, meaning that CRD Servers SHALL, at minimum, return a [Coverage Information](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-ext-coverage-information.html)
13
- system action for these hooks, even if the response indicates that further information is needed or that the
14
- level of detail provided is insufficient to determine coverage.
15
- )
16
- verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@218', 'hl7.fhir.us.davinci-crd_2.0.1@225',
17
- 'hl7.fhir.us.davinci-crd_2.0.1@243', 'hl7.fhir.us.davinci-crd_2.0.1@244',
18
- 'hl7.fhir.us.davinci-crd_2.0.1@245'
19
-
20
- config options: { accepts_multiple_requests: true }
21
-
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
30
- input :order_sign_selected_response_types,
31
- title: 'Response types to return from order-sign hook requests',
32
- description: %(
33
- Select the cards/action response types that the Inferno hook request endpoints will return. The default
34
- response type that will be returned for this hook is the `Coverage Information` card type.
35
- ),
36
- type: 'checkbox',
37
- default: ['coverage_information', 'external_reference', 'instructions'],
38
- optional: true,
39
- options: {
40
- list_options: [
41
- {
42
- label: 'External Reference',
43
- value: 'external_reference'
44
- },
45
- {
46
- label: 'Instructions',
47
- value: 'instructions'
48
- },
49
- {
50
- label: 'Coverage Information',
51
- value: 'coverage_information'
52
- },
53
- {
54
- label: 'Request Form Completion',
55
- value: 'request_form_completion'
56
- },
57
- {
58
- label: 'Create/Update Coverage Information',
59
- value: 'create_update_coverage_info'
60
- },
61
- {
62
- label: 'Launch SMART Application',
63
- value: 'launch_smart_app'
64
- },
65
- {
66
- label: 'Propose Alternate Request',
67
- value: 'propose_alternate_request'
68
- },
69
- {
70
- label: 'Additional Orders as Companions/Prerequisites',
71
- value: 'companions_prerequisites'
72
- }
73
- ]
74
- }
75
- input :order_sign_custom_response,
76
- title: 'Custom response for order-sign hook requests',
77
- description: %(
78
- A JSON string may be provided here to replace the normal response
79
- from the hook request endpoint
80
- ),
81
- type: 'textarea',
82
- optional: true
83
-
84
- run do
85
- wait(
86
- identifier: "order-sign #{cds_jwt_iss}",
87
- message: %(
88
- **Order Sign CDS Service Test**:
89
-
90
- Invoke the order-sign hook and send requests to:
91
-
92
- `#{order_sign_url}`
93
-
94
- Inferno will process the requests and return CDS cards if successful.
95
-
96
- [Click here](#{resume_pass_url}?token=order-sign%20#{cds_jwt_iss}) when you have finished submitting requests.
97
- )
98
- )
99
- end
100
- end
101
- end
@@ -1,105 +0,0 @@
1
- require_relative '../client_hook_request_validation'
2
-
3
- module DaVinciCRDTestKit
4
- class RetrieveJWKSTest < Inferno::Test
5
- include ClientHookRequestValidation
6
-
7
- id :crd_retrieve_jwks
8
- title 'JWKS can be retrieved'
9
- description %(
10
- Verify that the JWKS can be retrieved from the JWKS uri if it is present in the `jku` field within the JWT token
11
- header. As per the [CDS hooks specification](https://cds-hooks.hl7.org/2.0#trusting-cds-clients), if the jku
12
- header field is omitted, the CDS Client and CDS Service SHALL communicate the JWK Set out-of-band. Therefore,
13
- if the client does not make their keys publicly available via a uri in the `jku` field, the user must
14
- submit the jwk_set as an input to the test.
15
- )
16
-
17
- input :auth_token_headers_json
18
- input :cds_jwk_set,
19
- title: 'CRD JSON Web Key Set (JWKS)',
20
- type: 'textarea',
21
- description: %(
22
- The client's registered JWK Set containing it's public key, either
23
- as a publicly accessible url containing the JWKS, or the raw JWKS.
24
- Run or re-run the **Client Registration** group to set or
25
- change this value. Used if the `jku` header is not found in the auth token jwt.
26
- ),
27
- locked: true,
28
- optional: true
29
- output :crd_jwks_json, :crd_jwks_keys_json
30
-
31
- run do
32
- auth_token_headers = JSON.parse(auth_token_headers_json)
33
- skip_if auth_token_headers.empty?, 'No Authorization tokens produced from the previous test.'
34
-
35
- crd_jwks_json = []
36
- crd_jwks_keys_json = []
37
- auth_token_headers.each_with_index do |token_header, index|
38
- @request_number = index + 1
39
-
40
- jku = JSON.parse(token_header)['jku']
41
- if jku.present?
42
- get(jku)
43
-
44
- if response[:status] != 200
45
- add_message('error', %(
46
- #{request_number}Unexpected response status: expected 200, but received
47
- #{response[:status]}))
48
- next
49
- end
50
-
51
- @request_number = index + 1
52
- jwks = json_parse(response[:body])
53
- next if jwks.blank?
54
-
55
- crd_jwks_json << response[:body]
56
-
57
- jwks = JSON.parse(response[:body])
58
- else
59
- skip_if cds_jwk_set.blank?,
60
- %(#{request_number}JWK Set must be inputted if Client's JWK Set is not available via a URL
61
- identified by the jku header field)
62
-
63
- jwks = JSON.parse(cds_jwk_set)
64
- end
65
-
66
- keys = jwks['keys']
67
- unless keys.is_a?(Array)
68
- add_message('error', "#{request_number}JWKS `keys` field must be an array")
69
- next
70
- end
71
-
72
- if keys.blank?
73
- add_message('error', "#{request_number}The JWK set returned contains no public keys")
74
- next
75
- end
76
-
77
- keys.each do |jwk|
78
- JWT::JWK.import(jwk.deep_symbolize_keys)
79
- rescue StandardError
80
- add_message('error', "#{request_number}Invalid JWK: #{jwk.to_json}")
81
- end
82
-
83
- kid_presence = keys.all? { |key| key['kid'].present? }
84
- if kid_presence.blank?
85
- add_message('error',
86
- "#{request_number}`kid` field must be present in each key if JWKS contains multiple keys")
87
- next
88
- end
89
-
90
- kid_uniqueness = keys.map { |key| key['kid'] }.uniq.length == keys.length
91
- if kid_uniqueness.blank?
92
- add_message('error', "#{request_number}`kid` must be unique within the client's JWK Set.")
93
- next
94
- end
95
-
96
- crd_jwks_keys_json << keys.to_json
97
- end
98
-
99
- output crd_jwks_json: crd_jwks_json.to_json,
100
- crd_jwks_keys_json: crd_jwks_keys_json.to_json
101
-
102
- no_error_validation('Retrieving JWKS failed.')
103
- end
104
- end
105
- end
@@ -1,48 +0,0 @@
1
- module DaVinciCRDTestKit
2
- class SubmittedResponseValidationTest < Inferno::Test
3
- include CardsValidation
4
-
5
- title 'Custom CDS Service Response is valid'
6
- description %(
7
- If a custom CDS Service response is provided for Inferno to return when simulating the CRD Server's
8
- hook response, this test will check that it is a valid CRD hook response.
9
- )
10
- id :crd_submitted_response_validation
11
-
12
- input :custom_response, optional: true
13
-
14
- def hook_name
15
- config.options[:hook_name]
16
- end
17
-
18
- def response_label(_index = nil)
19
- 'Custom response'
20
- end
21
-
22
- def valid_cards
23
- @valid_cards ||= []
24
- end
25
-
26
- def validate_system_actions(system_actions)
27
- return if system_actions.nil?
28
-
29
- system_actions.each do |action|
30
- action_fields_validation(action)
31
- end
32
- end
33
-
34
- run do
35
- omit_if custom_response.blank?, 'Custom response was not provided'
36
-
37
- assert_valid_json custom_response
38
-
39
- custom_response_hash = JSON.parse(custom_response)
40
-
41
- perform_cards_validation(custom_response_hash['cards'])
42
-
43
- validate_system_actions(custom_response_hash['systemActions'])
44
-
45
- no_error_validation('Custom response is not valid. Check messages for issues found.')
46
- end
47
- end
48
- end
@@ -1,65 +0,0 @@
1
- require_relative '../client_hook_request_validation'
2
-
3
- module DaVinciCRDTestKit
4
- class TokenHeaderTest < Inferno::Test
5
- include ClientHookRequestValidation
6
-
7
- id :crd_token_header
8
- title 'Authorization token header contains required information'
9
- description %(
10
- Verify that the JWT header contains the header fields required by the [CDS hooks spec](https://cds-hooks.hl7.org/2.0#trusting-cds-clients).
11
- The `alg`, `kid`, and `typ` fields are required. This test also verifies that the `typ` field is set to `JWT` and
12
- that the key used to sign the token can be identified in the JWKS.
13
- )
14
-
15
- input :auth_token_headers_json, :crd_jwks_keys_json
16
- output :auth_tokens_jwk_json
17
-
18
- run do
19
- auth_token_headers = JSON.parse(auth_token_headers_json)
20
- crd_jwks_keys = JSON.parse(crd_jwks_keys_json)
21
- skip_if auth_token_headers.empty?, 'No Authorization tokens produced from the previous tests.'
22
- skip_if crd_jwks_keys.empty?, 'No JWKS keys produced from the previous test.'
23
-
24
- auth_tokens_jwk_json = []
25
- auth_token_headers.each_with_index do |token_header, index|
26
- @request_number = index + 1
27
-
28
- header = JSON.parse(token_header)
29
- algorithm = header['alg']
30
-
31
- add_message('error', "#{request_number}Token header must have the `alg` field") if algorithm.blank?
32
-
33
- add_message('error', "#{request_number}Token header `alg` field cannot be set to none") if algorithm == 'none'
34
-
35
- if header['typ'].blank?
36
- add_message('error', "#{request_number}Token header must have the `typ` field")
37
- elsif header['typ'] != 'JWT'
38
- add_message('error', %(
39
- #{request_number}Token header `typ` field must be set to 'JWT', instead was
40
- #{header['typ']}))
41
- end
42
-
43
- if header['kid'].blank?
44
- add_message('error', "#{request_number}Token header must have the `kid` field")
45
- next
46
- end
47
-
48
- kid = header['kid']
49
- keys = JSON.parse(crd_jwks_keys[index])
50
-
51
- jwk = keys.find { |key| key['kid'] == kid }
52
- if jwk.blank?
53
- add_message('error', "#{request_number}JWKS did not contain a public key with an id of `#{kid}`")
54
- next
55
- end
56
-
57
- auth_tokens_jwk_json << jwk.to_json
58
- end
59
-
60
- output auth_tokens_jwk_json: auth_tokens_jwk_json.to_json
61
-
62
- no_error_validation('Token headers missing required information.')
63
- end
64
- end
65
- end
@@ -1,78 +0,0 @@
1
- require_relative '../client_hook_request_validation'
2
-
3
- module DaVinciCRDTestKit
4
- class TokenPayloadTest < Inferno::Test
5
- include ClientHookRequestValidation
6
- include URLs
7
- id :crd_token_payload
8
- title 'Authorization token payload has required claims and a valid signature'
9
- description %(
10
- Verify that the JWT payload contains the payload fields required by the
11
- [CDS hooks spec](https://cds-hooks.hl7.org/2.0#trusting-cds-clients).
12
- The `iss`, `aud`, `exp`, `iat`, and `jti` claims are required.
13
- Additionally:
14
-
15
- - `iss` must match the `issuer` from the **CRD JWT Issuer** input
16
- - `aud` must match the URL of the CDS Service endpoint being invoked
17
- - `exp` must represent a time in the future
18
- - `jti` must be a non-blank string that uniquely identifies this authentication JWT
19
- )
20
-
21
- REQUIRED_CLAIMS = ['iss', 'aud', 'exp', 'iat', 'jti'].freeze
22
-
23
- def required_claims
24
- REQUIRED_CLAIMS.dup
25
- end
26
-
27
- def hook_url
28
- base_url + config.options[:hook_path]
29
- end
30
-
31
- input :auth_tokens,
32
- :auth_tokens_jwk_json,
33
- :cds_jwt_iss
34
-
35
- run do
36
- auth_tokens_list = JSON.parse(auth_tokens)
37
- auth_tokens_jwk = JSON.parse(auth_tokens_jwk_json)
38
- skip_if auth_tokens_list.empty?, 'No Authorization tokens produced from the previous tests.'
39
- skip_if auth_tokens_jwk.empty?, 'No Authorization token JWK produced from the previous test.'
40
-
41
- auth_tokens_jwk.each_with_index do |auth_token_jwk, index|
42
- @request_number = index + 1
43
-
44
- begin
45
- jwk = JSON.parse(auth_token_jwk).deep_symbolize_keys
46
-
47
- payload, =
48
- JWT.decode(
49
- auth_tokens_list[index],
50
- JWT::JWK.import(jwk).public_key,
51
- true,
52
- algorithms: [jwk[:alg]],
53
- exp_leeway: 60,
54
- iss: cds_jwt_iss,
55
- aud: hook_url,
56
- verify_not_before: false,
57
- verify_iat: false,
58
- verify_jti: true,
59
- verify_iss: true,
60
- verify_aud: true
61
- )
62
- rescue StandardError => e
63
- add_message('error', "#{request_number}Token validation error: #{e.message}")
64
- next
65
- end
66
-
67
- missing_claims = required_claims - payload.keys
68
- missing_claims_string = missing_claims.map { |claim| "`#{claim}`" }.join(', ')
69
-
70
- unless missing_claims.empty?
71
- add_message('error', "#{request_number}JWT payload missing required claims: #{missing_claims_string}")
72
- next
73
- end
74
- end
75
- no_error_validation('Token payload is missing required claims or does not have a valid signiture.')
76
- end
77
- end
78
- end
@@ -1,193 +0,0 @@
1
- require_relative 'client_fhir_api_group'
2
- require_relative 'client_hooks_group'
3
- require_relative 'client_registration_group'
4
- require_relative 'routes/cds_services_discovery_handler'
5
- require_relative 'tags'
6
- require_relative 'urls'
7
- require_relative 'crd_options'
8
- require_relative 'routes/hook_request_endpoint'
9
- require_relative 'ext/inferno_core/runnable'
10
-
11
- module DaVinciCRDTestKit
12
- class CRDClientSuite < Inferno::TestSuite
13
- id :crd_client
14
- title 'Da Vinci CRD Client Test Suite'
15
- description <<~DESCRIPTION
16
- The Da Vinci CRD Client Test Suite tests the conformance of client systems
17
- to [version 2.0.1 of the Da Vinci Coverage Requirements Discovery (CRD)
18
- Implementation Guide](https://hl7.org/fhir/us/davinci-crd/STU2).
19
-
20
- ## Overview
21
- This suite contains two groups of tests. The Hooks group receives and
22
- responds to incoming CDS Hooks requests from CRD clients. The FHIR API
23
- group makes FHIR requests to CRD Clients to verify that they support the
24
- FHIR interactions defined in the implementation guide.
25
-
26
- ## CDS Services
27
- This suite provides basic CDS services for [the six hooks contained in the
28
- implementation
29
- guide](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html). The discovery
30
- endpoint is located at:
31
-
32
- * `#{Inferno::Application['base_url']}/custom/#{id}/cds-services`
33
-
34
- ## SMART App Launch
35
- Use this information when registering Inferno as a SMART App:
36
-
37
- * Launch URI: `#{SMARTAppLaunch::AppLaunchTest.config.options[:launch_uri] ||
38
- "#{Inferno::Application['base_url']}/custom/smart/launch"}`
39
- * Redirect URI: `#{SMARTAppLaunch::AppRedirectTest.config.options[:redirect_uri] ||
40
- "#{Inferno::Application['base_url']}/custom/smart/redirect"}`
41
-
42
- If a client receives a SMART App Launch card in a response and would like
43
- to test their ability to launch Inferno as a SMART App, first run the
44
- SMART on FHIR Discovery and SMART EHR Launch groups under FHIR API >
45
- Authorization. When running the SMART EHR Launch group, Inferno will wait
46
- for the incoming SMART App Launch request, and this is the time to perform
47
- the launch from the client being tested.
48
-
49
- ## Running the Tests
50
- If you would like to try out the tests against [the public CRD reference
51
- client](https://crd-request-generator.davinci.hl7.org/), you can do so by:
52
- 1. Selecting the *CRD Request Generator RI* option from the Preset
53
- dropdown in the upper left.
54
- 2. Selecting the *order-sign* hook group on the left menu.
55
- 3. Clicking on the *RUN TESTS* button in the upper right.
56
- 4. Clicking the *Submit* button at the bottom of the input dialog.
57
- 5. Follow the instructions in the wait dialog.
58
- 6. Open the reference client in another tab/browser.
59
- 7. Update the *CRD Server* field in the client configuration to point to
60
- the discovery endpoint of this suite provided above, and the *Order
61
- Sign Rest End Point*
62
- to the service id provided in the wait dialog.
63
- 8. Select the patient data to be used to form the request, then submit the
64
- request.
65
-
66
- You can run these tests using your own client by updating the inputs with
67
- your own data.
68
-
69
- Note that:
70
- - You can only sequentially *RUN ALL TESTS* if your system supports all
71
- hooks.
72
- - Systems are not expected to pass the *FHIR RESTful Capabilities* tests
73
- based on the provided inputs, as the resource might not exist on the
74
- client's FHIR server.
75
-
76
- ## Running the Tests aginst the Server Suite
77
-
78
- You can also run these tests against the Inferno CRD Server test suite.
79
- The server suite will not render cards like a real CRD client would do,
80
- but will simulate and verify the interactions between the client and
81
- server.
82
-
83
- 1. Start a "Da Vinci CRD Client Test Suite" session.
84
- 1. Choose the "Inferno CRD Server Suite" preset from the drop down in the upper left.
85
- 1. Run the Client Registration test group. It should pass.
86
- 1. Run the Hooks > Appointment Book test group leaving the inputs as is. A
87
- "User Action Dialog" will appear indicating that Inferno is waiting for the
88
- `appointment-book` hook invocation.
89
- 1. In another tab, start a "Da Vinci CRD Server Test Suite" session.
90
- 1. Choose the "Inferno CRD Client Suite" preset from the drop down in the upper left.
91
- 1. Run the Discovery test group. It should pass.
92
- 1. Run the Demonstrate A Hook Response test. It should pass
93
- 1. Return to the client suite and click the link to continue the tests.
94
- 1. When the attestation wait dialog appears, return to the server tests and look in test
95
- **2.04** "All service responses contain valid cards and optional systemActions"
96
- for the CDS hooks request made and look at the response to verify that the
97
- indicate cards are present. Attest accordingly in the client suite to complete the tests.
98
-
99
- ## Limitations
100
- The test suite does not implement any sort of payer business logic, so the
101
- responses to hook calls are simple hard-coded responses. Hook
102
- configuration is not tested.
103
- DESCRIPTION
104
-
105
- suite_summary <<~SUMMARY
106
- The Da Vinci CRD Client Test Suite tests the conformance of client systems
107
- to [version 2.0.1 of the Da Vinci Coverage Requirements Discovery (CRD)
108
- Implementation Guide](https://hl7.org/fhir/us/davinci-crd/STU2).
109
- SUMMARY
110
-
111
- links [
112
- {
113
- label: 'Report Issue',
114
- url: 'https://github.com/inferno-framework/davinci-crd-test-kit/issues'
115
- },
116
- {
117
- label: 'Open Source',
118
- url: 'https://github.com/inferno-framework/davinci-crd-test-kit'
119
- },
120
- {
121
- label: 'Download',
122
- url: 'https://github.com/inferno-framework/davinci-crd-test-kit/releases'
123
- }
124
- ]
125
-
126
- requirement_sets(
127
- {
128
- identifier: 'hl7.fhir.us.davinci-crd_2.0.1',
129
- title: 'Da Vinci Coverage Requirements Discovery (CRD) v2.0.1',
130
- actor: 'Client'
131
- }
132
- )
133
-
134
- fhir_resource_validator do
135
- igs('hl7.fhir.us.davinci-crd#2.0.1')
136
-
137
- exclude_message do |message|
138
- message.message.match?(/\A\S+: \S+: URL value '.*' does not resolve/)
139
- end
140
- end
141
-
142
- suite_option :smart_app_launch_version,
143
- title: 'SMART App Launch Version',
144
- list_options: [
145
- {
146
- label: 'SMART App Launch 1.0.0',
147
- value: CRDOptions::SMART_1
148
- },
149
- {
150
- label: 'SMART App Launch 2.0.0',
151
- value: CRDOptions::SMART_2
152
- }
153
- ]
154
-
155
- def self.extract_token_from_query_params(request)
156
- request.query_parameters['token']
157
- end
158
-
159
- route :get, '/cds-services', Routes::CDSServicesDiscoveryHandler
160
- # TODO
161
- # route :post, '/cds-services/:cds-service_id', cds_service_handler
162
-
163
- allow_cors APPOINTMENT_BOOK_PATH, ENCOUNTER_START_PATH, ENCOUNTER_DISCHARGE_PATH, ORDER_DISPATCH_PATH,
164
- ORDER_SELECT_PATH, ORDER_SIGN_PATH
165
- suite_endpoint :post, APPOINTMENT_BOOK_PATH, HookRequestEndpoint
166
- suite_endpoint :post, ENCOUNTER_START_PATH, HookRequestEndpoint
167
- suite_endpoint :post, ENCOUNTER_DISCHARGE_PATH, HookRequestEndpoint
168
- suite_endpoint :post, ORDER_DISPATCH_PATH, HookRequestEndpoint
169
- suite_endpoint :post, ORDER_SELECT_PATH, HookRequestEndpoint
170
- suite_endpoint :post, ORDER_SIGN_PATH, HookRequestEndpoint
171
-
172
- resume_test_route :get, RESUME_PASS_PATH do |request|
173
- CRDClientSuite.extract_token_from_query_params(request)
174
- end
175
- resume_test_route :get, RESUME_FAIL_PATH, result: 'fail' do |request|
176
- CRDClientSuite.extract_token_from_query_params(request)
177
- end
178
-
179
- group do
180
- id :crd_client_hook_invocation
181
- title 'Hook Invocation'
182
- description %(
183
- This groups checks that the system can register as a CDS Client with
184
- Inferno's simulated CRD Server and make hook invocations.
185
- )
186
-
187
- group from: :crd_client_registration
188
- group from: :crd_client_hooks
189
- end
190
-
191
- group from: :crd_client_fhir_api
192
- end
193
- end