davinci_crd_test_kit 0.14.2 → 0.15.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 (234) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +13 -1
  3. data/config/presets/server_v221_against_inferno_crd_client_suite.json.erb +1 -1
  4. data/config/presets/server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb +1 -1
  5. data/lib/davinci_crd_test_kit/client/client_base_urls.rb +5 -0
  6. data/lib/davinci_crd_test_kit/client/client_input_helper.rb +102 -0
  7. data/lib/davinci_crd_test_kit/client/client_wait_messages.rb +68 -0
  8. data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +25 -10
  9. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_data_access.rb +228 -0
  10. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +116 -25
  11. data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +5 -24
  12. data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +1 -1
  13. data/lib/davinci_crd_test_kit/client/endpoints/v201_hook_request_data_gathering.rb +219 -0
  14. data/lib/davinci_crd_test_kit/client/endpoints/v221_hook_request_data_gathering.rb +172 -0
  15. data/lib/davinci_crd_test_kit/client/jwt_claim_types.rb +28 -0
  16. data/lib/davinci_crd_test_kit/client/multi_request_message_helper.rb +1 -1
  17. data/lib/davinci_crd_test_kit/client/prefetched_coverage_payer_helper.rb +81 -0
  18. data/lib/davinci_crd_test_kit/client/prefetched_coverage_value.rb +14 -0
  19. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +8 -0
  20. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +1 -1
  21. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_header_test.rb +14 -4
  22. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +8 -1
  23. data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +1 -1
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/client_fhir_api_group.rb +2 -2
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +2 -5
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/crd_client_suite.rb +2 -2
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/appointment_book_receive_request_test.rb +10 -31
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_discharge_receive_request_test.rb +10 -31
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/encounter_start_receive_request_test.rb +8 -29
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_dispatch_receive_request_test.rb +10 -31
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_select_receive_request_test.rb +8 -29
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/invocation/order_sign_receive_request_test.rb +10 -31
  33. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_registration_verification_test.rb +3 -7
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/registration/client_service_registration_attestation_test.rb +11 -3
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_optional_fields_test.rb +1 -1
  36. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +4 -4
  37. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +1 -1
  38. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +9 -9
  39. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_crd_update_verification_group.rb +1 -1
  40. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +10 -10
  41. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +7 -7
  42. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +4 -4
  43. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +4 -4
  44. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +6 -5
  45. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +4 -4
  46. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +4 -4
  47. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +4 -4
  48. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +4 -4
  49. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +3 -1
  50. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +23 -13
  51. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_header_test.rb +32 -6
  52. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +25 -11
  53. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +1 -1
  54. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +1 -1
  55. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +10 -3
  56. data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +1 -7
  57. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +13 -10
  58. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +12 -4
  59. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +9 -2
  60. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +9 -2
  61. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +25 -3
  62. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +7 -10
  63. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +3 -3
  64. data/lib/davinci_crd_test_kit/client/v2.2.1/client_multiple_payers_hook_group.rb +40 -0
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +9 -2
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +8 -1
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +9 -2
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +7 -7
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +10 -4
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +2 -4
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +3 -3
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/client_user_access_level_group.rb +82 -0
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +7 -3
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +4 -4
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +3 -3
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +2 -2
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_jwt_ids_unique_test.rb +89 -0
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +59 -29
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_order_types_signed_test.rb +101 -0
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +11 -24
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +9 -27
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +59 -40
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +64 -35
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +9 -27
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +9 -27
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +9 -27
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +9 -27
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +9 -27
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +50 -38
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +11 -11
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_request_verification_test.rb +215 -0
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/multiple_payers/client_multiple_payers_workflow_test.rb +71 -0
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_must_support_test.rb +84 -0
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/appointment_reference_resolution_test.rb +82 -0
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/client_cross_hook_must_support_group.rb +181 -0
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_must_support_test.rb +69 -0
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/communication_request_reference_resolution_test.rb +79 -0
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_must_support_test.rb +73 -0
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/coverage_reference_resolution_test.rb +67 -0
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_must_support_test.rb +59 -0
  101. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_must_support_test.rb +72 -0
  102. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/device_request_reference_resolution_test.rb +76 -0
  103. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_must_support_test.rb +83 -0
  104. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/encounter_reference_resolution_test.rb +76 -0
  105. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_must_support_test.rb +63 -0
  106. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/location_reference_resolution_test.rb +60 -0
  107. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_must_support_test.rb +54 -0
  108. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_must_support_test.rb +95 -0
  109. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/medication_request_reference_resolution_test.rb +79 -0
  110. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_must_support_test.rb +136 -0
  111. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/nutrition_order_reference_resolution_test.rb +67 -0
  112. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_must_support_test.rb +66 -0
  113. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/organization_reference_resolution_test.rb +60 -0
  114. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/patient_must_support_test.rb +69 -0
  115. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_must_support_test.rb +65 -0
  116. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_must_support_test.rb +60 -0
  117. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/practitioner_role_reference_resolution_test.rb +66 -0
  118. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_must_support_test.rb +93 -0
  119. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/service_request_reference_resolution_test.rb +81 -0
  120. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_must_support_test.rb +79 -0
  121. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/generated/vision_prescription_reference_resolution_test.rb +65 -0
  122. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_reference_resolution.rb +379 -0
  123. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_scope.rb +66 -0
  124. data/lib/davinci_crd_test_kit/client/v2.2.1/must_support/request_must_support_with_attestation_option.rb +331 -0
  125. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_registration_verification_test.rb +16 -30
  126. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +84 -39
  127. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +27 -20
  128. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +7 -7
  129. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +38 -33
  130. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_api_access_test.rb +124 -0
  131. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_prefetch_scope_test.rb +85 -0
  132. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_receive_request_test.rb +92 -0
  133. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_same_scenario_test.rb +340 -0
  134. data/lib/davinci_crd_test_kit/client/v2.2.1/user_access_level/access_level_target_reference.rb +16 -0
  135. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +63 -6
  136. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +23 -73
  137. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +12 -2
  138. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +7 -7
  139. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +11 -13
  140. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +2 -2
  141. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +16 -4
  142. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
  143. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +8 -8
  144. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +3 -3
  145. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +8 -9
  146. data/lib/davinci_crd_test_kit/cross_suite/base_urls.rb +12 -0
  147. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -2
  148. data/lib/davinci_crd_test_kit/cross_suite/fhirpath_on_cds_request.rb +10 -9
  149. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_with_order/metadata.yml +67 -0
  150. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/appointment_without_order/metadata.yml +150 -0
  151. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/communication_request/metadata.yml +71 -0
  152. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/coverage/metadata.yml +71 -0
  153. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device/metadata.yml +22 -0
  154. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/device_request/metadata.yml +85 -0
  155. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/encounter/metadata.yml +82 -0
  156. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/hrex_organization/metadata.yml +6 -0
  157. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/location/metadata.yml +27 -0
  158. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication/metadata.yml +17 -0
  159. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/medication_request/metadata.yml +166 -0
  160. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/nutrition_order/metadata.yml +166 -0
  161. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/organization/metadata.yml +42 -0
  162. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/patient/metadata.yml +29 -0
  163. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner/metadata.yml +37 -0
  164. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/practitioner_role/metadata.yml +36 -0
  165. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/service_request/metadata.yml +202 -0
  166. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_allergyintolerance/metadata.yml +6 -0
  167. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_encounter_diagnosis/metadata.yml +6 -0
  168. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_condition_problems_health_concerns/metadata.yml +6 -0
  169. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_lab/metadata.yml +6 -0
  170. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_diagnosticreport_note/metadata.yml +6 -0
  171. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_documentreference/metadata.yml +6 -0
  172. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_location/metadata.yml +6 -0
  173. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_organization/metadata.yml +6 -0
  174. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_patient/metadata.yml +6 -0
  175. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_practitioner/metadata.yml +6 -0
  176. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/us_core_procedure/metadata.yml +6 -0
  177. data/lib/davinci_crd_test_kit/cross_suite/generated/v2.2.1/vision_prescription/metadata.yml +66 -0
  178. data/lib/davinci_crd_test_kit/cross_suite/hook_request_field_validation.rb +3 -2
  179. data/lib/davinci_crd_test_kit/cross_suite/hook_request_resource_extraction.rb +121 -0
  180. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +17 -9
  181. data/lib/davinci_crd_test_kit/cross_suite/must_support_references.rb +49 -0
  182. data/lib/davinci_crd_test_kit/cross_suite/must_support_slice_matching.rb +50 -0
  183. data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +75 -39
  184. data/lib/davinci_crd_test_kit/cross_suite/profile_metadata.rb +75 -0
  185. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +19 -9
  186. data/lib/davinci_crd_test_kit/cross_suite/resource_identity.rb +183 -0
  187. data/lib/davinci_crd_test_kit/cross_suite/short_circuit_interaction.rb +28 -0
  188. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +15 -1
  189. data/lib/davinci_crd_test_kit/generator/crd_must_support_metadata_extractor.rb +147 -0
  190. data/lib/davinci_crd_test_kit/generator/must_support_metadata_generator.rb +207 -0
  191. data/lib/davinci_crd_test_kit/generator/must_support_test_generator.rb +249 -0
  192. data/lib/davinci_crd_test_kit/generator/templates/must_support_group.rb.erb +118 -0
  193. data/lib/davinci_crd_test_kit/generator/templates/must_support_test.rb.erb +22 -0
  194. data/lib/davinci_crd_test_kit/generator/templates/reference_resolution_test.rb.erb +22 -0
  195. data/lib/davinci_crd_test_kit/igs/davinci_crd_2.2.1.tgz +0 -0
  196. data/lib/davinci_crd_test_kit/igs/davinci_hrex_1.2.0.tgz +0 -0
  197. data/lib/davinci_crd_test_kit/metadata.rb +2 -2
  198. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +3 -2
  199. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +1 -1
  200. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +90 -89
  201. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  202. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_create_endpoint.rb +2 -0
  203. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_delete_endpoint.rb +2 -0
  204. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_read_endpoint.rb +2 -0
  205. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_request_handler.rb +6 -0
  206. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_search_endpoint.rb +21 -12
  207. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr/fhir_update_endpoint.rb +2 -0
  208. data/lib/davinci_crd_test_kit/server/endpoints/mock_ehr_endpoints.rb +3 -0
  209. data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +2 -2
  210. data/lib/davinci_crd_test_kit/server/v2.2.1/must_support/supported_us_core_versions_test.rb +2 -2
  211. data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +1 -1
  212. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +1 -1
  213. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +1 -1
  214. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +1 -1
  215. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +1 -1
  216. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +1 -1
  217. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +1 -1
  218. data/lib/davinci_crd_test_kit/server/v2.2.1/server_required_card_response_validation_group.rb +1 -1
  219. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_not_found_group.rb +1 -1
  220. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_active_coverage_group.rb +1 -1
  221. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_member_found_group.rb +1 -1
  222. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_group.rb +1 -1
  223. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +1 -1
  224. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_no_custom_extensions_test.rb +2 -2
  225. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +1 -1
  226. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +1 -1
  227. data/lib/davinci_crd_test_kit/version.rb +2 -2
  228. metadata +100 -12
  229. data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +0 -413
  230. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +0 -45
  231. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +0 -43
  232. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +0 -42
  233. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +0 -30
  234. data/lib/davinci_crd_test_kit/server/resource_extractor.rb +0 -68
@@ -1,4 +1,5 @@
1
1
  require_relative '../client_urls'
2
+ require_relative '../../client_input_helper'
2
3
 
3
4
  module DaVinciCRDTestKit
4
5
  module V221
@@ -6,47 +7,53 @@ module DaVinciCRDTestKit
6
7
  include ClientURLs
7
8
 
8
9
  id :crd_v221_client_self_pay_workflow
9
- title 'Client performs a self-pay workflow'
10
+ title 'CRD client does not invoke hooks when the patient intends to bypass insurance coverage'
10
11
  description %(
12
+ The CRD IG [requires](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/deviations.html#ci-c-dev-26)
13
+ that CRD clients only invoke hooks on payer services where the patient record indicates
14
+ active coverage with the payer associated with the service and where there is no recorded
15
+ indication the patient intends to bypass insurance coverage, i.e., the service or product
16
+ is not flagged as 'self-pay' or 'patient-pay'.
17
+
11
18
  During this test, the tester will perform a self-pay scenario in which a patient has indicated
12
- that they will pay for a service instead of asking their insurance to cover it. Because there
13
- is a recorded indication that the patient intends to bypass insurance coverage, the client
14
- is required to not invoke any hooks that would send details of the service to the payer.
15
- The scenario must include an action related to the service that would normally trigger a
16
- hook request and Inferno will verify that no hook requests are received.
19
+ that they will pay for a product or service instead of asking their insurance to cover it.
20
+ The scenario must include an action related to the product or service that would normally
21
+ trigger a hook request. The test will fail immediately if Inferno receives a hook request
22
+ while the tester takes the necessary steps in the CRD client. If the tester's actions in the
23
+ CRD client complete without triggering any hook requests to Inferno, the tester will provide
24
+ an attestation to that effect to complete the test.
17
25
  )
18
26
 
27
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@dev-26-B'
28
+
19
29
  input :cds_jwt_iss,
20
30
  title: 'CRD JWT Issuer',
21
- description: %(
22
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
23
- request sent as the Bearer token in the `Authorization` header.
24
- Run or re-run the "Registration" group to set or change this value.
25
- ),
31
+ description: ClientInputHelper.locked_cds_jwt_iss_description,
26
32
  locked: true
27
33
  output :continuation_url
34
+ flag_as_tester_initiated_exchange
35
+ flag_as_attestation
28
36
 
29
37
  run do
30
38
  identifier = cds_jwt_iss
31
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
39
+ continuation_url = resume_pass_url_for(identifier)
32
40
  output(continuation_url:)
33
41
 
34
42
  wait(
35
43
  identifier:,
36
44
  message: %(
37
- **Self-Pay Workflow Test**:
45
+ #### Self-Pay Scenario Test
38
46
 
39
- Perform a workflow that would normally trigger a hook request, such as one
47
+ Perform actions in the CRD client that would normally trigger a hook request, such as one
40
48
  performed during previous tests, but for a service or product where the patient
41
- record contains an indication that the patient intends to self-pay. The client must
49
+ record contains an indication that the patient intends to self-pay. The CRD client must
42
50
  not send any hook requests to Inferno during the workflow.
43
51
 
44
- By [clicking here](#{continuation_url}) I attest that a user completed a workflow
45
- in the client system that would normally trigger a hook request for a service that
46
- has been marked as self-pay.
52
+ Once all necessary actions are complete, [click here](#{continuation_url}) to attest that
53
+ the steps that would normally trigger a hook request have been completed for a service
54
+ marked as self-pay.
47
55
 
48
- If Inferno receives a hook request, this test will automatically continue
49
- and the next test will fail.
56
+ If Inferno receives a hook request, this test will immediately fail.
50
57
  )
51
58
  )
52
59
  end
@@ -12,15 +12,15 @@ module DaVinciCRDTestKit
12
12
  KNOWN_ACTION_ELEMENTS = ['type', 'description', 'resource', 'resourceId', 'extension'].freeze
13
13
 
14
14
  id :crd_v221_client_unknown_content_attestation_test
15
- title 'Client processes coverage information returned with unknown content'
15
+ title 'CRD client processes coverage information returned with unknown content'
16
16
  description %(
17
17
  The CRD IG [requires](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/foundation.html#ci-c-found-33)
18
- that client systems ignore unexpected elements within CDS Hooks structures when processing
18
+ that CRD clients ignore unexpected elements within CDS Hooks structures when processing
19
19
  instances. During this test, the tester will confirm that the unknown element and custom extension
20
- included in the CDS section of the previous response did not prevent the client system from
20
+ included in the CDS section of the previous response did not prevent the CRD client from
21
21
  processing the returned coverage information and making it available to the user.
22
22
  )
23
- attestation
23
+ flag_as_attestation
24
24
 
25
25
  verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@found-33'
26
26
 
@@ -70,8 +70,8 @@ module DaVinciCRDTestKit
70
70
  'no coverage information system action was returned.'
71
71
 
72
72
  identifier = SecureRandom.hex(32)
73
- attest_true_url = "#{resume_pass_url}?token=#{identifier}"
74
- attest_false_url = "#{resume_fail_url}?token=#{identifier}"
73
+ attest_true_url = resume_pass_url_for(identifier)
74
+ attest_false_url = resume_fail_url_for(identifier)
75
75
  output(attest_true_url:)
76
76
  output(attest_false_url:)
77
77
  wait(
@@ -84,7 +84,7 @@ module DaVinciCRDTestKit
84
84
 
85
85
  #{format_unknown_content(bodies)}
86
86
 
87
- I attest that this unexpected content did not prevent the client system from
87
+ I attest that this unexpected content did not prevent the CRD client from
88
88
  processing the coverage information returned in the same response and that the
89
89
  coverage information was displayed or otherwise made available to the user:
90
90
 
@@ -1,61 +1,66 @@
1
+ require_relative '../../client_wait_messages'
1
2
  require_relative '../client_urls'
3
+ require_relative '../../client_input_helper'
2
4
 
3
5
  module DaVinciCRDTestKit
4
6
  module V221
5
7
  class ClientUnknownContentReceiveRequestTest < Inferno::Test
6
8
  include ClientURLs
9
+ include DaVinciCRDTestKit::ClientWaitMessages
7
10
 
8
11
  id :crd_v221_client_unknown_content_receive_request
9
- title 'Client invokes any hook'
12
+ title 'CRD client invokes any hook'
10
13
  description %(
11
- During this test, Inferno will wait while the client makes a single hook request of any type.
14
+ During this test, Inferno will wait while the CRD client makes a single hook request of any type.
12
15
  Inferno will return a fixed [mocked response](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses)
13
- containing a coverage information system action along with content that the client is not
16
+ containing a coverage information system action along with content that the CRD client is not
14
17
  expected to recognize: an element added to the system action and a custom extension added to
15
18
  the response, both with randomly generated names. This content is added at the CRD response
16
19
  level rather than within the FHIR resources carried in the response, and testers cannot change
17
20
  the response that is returned. The details of the request and its response do not matter for
18
21
  the purposes of this test and they will not be evaluated, checked for conformance, or included
19
- in cross-hook evaluations. The test will automatically continue after Inferno receives a hook
22
+ in cross-invocation evaluations. The test will automatically continue after Inferno receives a hook
20
23
  request and returns a response.
21
24
  )
22
25
  config options: { accepts_multiple_requests: true }
23
26
 
24
27
  input :cds_jwt_iss,
25
28
  title: 'CRD JWT Issuer',
26
- description: %(
27
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
28
- request sent as the Bearer token in the `Authorization` header.
29
- Run or re-run the "Registration" group to set or change this value.
30
- ),
29
+ description: ClientInputHelper.locked_cds_jwt_iss_description,
31
30
  locked: true
31
+ payer_organization_id_inputs
32
+ flag_as_tester_initiated_exchange
32
33
 
33
34
  run do
34
35
  identifier = cds_jwt_iss
35
- wait(
36
- identifier:,
37
- message: %(
38
- **Unknown Response Content Test**:
39
-
40
- Invoke any supported hook on one of the two Inferno simulated
41
- CRD servers discoverable at the following endpoints:
42
-
43
- - Complete Prefetch: `#{discovery_url}`
44
- - Subset Prefetch: `#{prefetch_subset_discovery_url}`
45
-
46
- For Inferno to recognize these requests and associate them with this session,
47
- the authentication JWT sent as a Bearer token in the Authorization header
48
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload. The test
49
- will automatically continue once Inferno has received a request and returned
50
- a response.
51
-
52
- The response will include coverage information alongside an element and a
53
- custom extension whose names are not defined by CRD or CDS Hooks. Clients
54
- must ignore the content they do not recognize and process the coverage
55
- information as usual. Testers will be asked to attest that this was
56
- demonstrated in the next test.
57
- )
58
- )
36
+ wait(identifier:, message: wait_message)
37
+ end
38
+
39
+ # wait messages are rendered as given, so keep every line flush to avoid markdown reading
40
+ # the indentation as a code block
41
+ def wait_message
42
+ <<~MESSAGE
43
+ #### Unknown Response Content Test
44
+
45
+ Invoke any supported hook on one of the two Inferno simulated
46
+ CRD servers and Inferno will return a response that includes some
47
+ random, unexpected content. The test will automatically continue once
48
+ Inferno has received a request and returned a response.
49
+
50
+ CRD clients must ignore the content they do not recognize and process
51
+ the coverage information as usual. Testers will be asked to certify that
52
+ this was demonstrated in the next test.
53
+
54
+ #{service_discovery_endpoints_section}
55
+ #### Authentication and Identification
56
+
57
+ #{session_identification_message}
58
+
59
+ #### Responses
60
+
61
+ The response will include coverage information alongside an element and a
62
+ custom extension whose names are not defined by CRD or CDS Hooks.
63
+ MESSAGE
59
64
  end
60
65
  end
61
66
  end
@@ -0,0 +1,124 @@
1
+ require_relative '../../tagged_request_load_helper'
2
+ require_relative '../../../cross_suite/tags'
3
+ require_relative 'access_level_target_reference'
4
+
5
+ module DaVinciCRDTestKit
6
+ module V221
7
+ class AccessLevelApiAccessTest < Inferno::Test
8
+ include DaVinciCRDTestKit::TaggedRequestLoadHelper
9
+ include AccessLevelTargetReference
10
+
11
+ id :crd_v221_access_level_api_access
12
+ title 'FHIR API access to the target resource is scoped to the user'
13
+ description %(
14
+ During this test, Inferno will verify that the FHIR reads it made during hook processing of
15
+ the resource referenced in the **Target Resource Reference** input, using the access token
16
+ supplied in each of the full-access and limited-access hook requests, were scoped to the
17
+ user: the full-access read must return the target resource and the limited-access read
18
+ must not. The manner in which the limited-access
19
+ read is denied is not checked, as the specification does not require a particular approach.
20
+ )
21
+
22
+ verifies_requirements 'cds-hooks_3.0.0-ballot@63', 'cds-hooks_3.0.0-ballot@64',
23
+ 'cds-hooks_3.0.0-ballot@173'
24
+
25
+ input :access_level_target_reference,
26
+ title: 'Target Resource Reference',
27
+ locked: true
28
+
29
+ def target_fetch_request(hook_requests)
30
+ hook_instance = JSON.parse(hook_requests.first.request_body)['hookInstance']
31
+ load_tagged_requests(TagMethods.hook_instance_data_fetch_tag(hook_instance), ACCESS_LEVEL_TARGET_FETCH_TAG)
32
+ .first
33
+ end
34
+
35
+ def check_fhir_access_elements(hook_request, role)
36
+ body = JSON.parse(hook_request.request_body)
37
+ missing = []
38
+ missing << '`fhirServer`' if body['fhirServer'].blank?
39
+ unless body['fhirAuthorization'].is_a?(Hash) && body.dig('fhirAuthorization', 'access_token').present?
40
+ missing << '`fhirAuthorization.access_token`'
41
+ end
42
+ return if missing.blank?
43
+
44
+ add_message('error',
45
+ "The #{role} hook request did not include #{missing.to_sentence}, so Inferno could " \
46
+ "not read `#{access_level_target_reference}` using that user's access token.")
47
+ rescue JSON::ParserError => e
48
+ add_message('error', "Unable to parse the #{role} hook request body as JSON: #{e.message}")
49
+ end
50
+
51
+ def parse_fhir_resource(body)
52
+ FHIR.from_contents(body)
53
+ rescue StandardError
54
+ nil
55
+ end
56
+
57
+ def target_resource_returned?(fetch_request)
58
+ expected_type, expected_id = access_level_target_reference.split('/')
59
+ resource = parse_fhir_resource(fetch_request.response_body)
60
+
61
+ resource.present? && resource.resourceType == expected_type && resource.id == expected_id
62
+ end
63
+
64
+ run do
65
+ full_hook_requests = load_tagged_requests(ACCESS_LEVEL_FULL_GROUP_TAG)
66
+ limited_hook_requests = load_tagged_requests(ACCESS_LEVEL_LIMITED_GROUP_TAG)
67
+
68
+ skip_if full_hook_requests.blank?,
69
+ 'Full-access hook request was not successful. Check the response for details and re-try.'
70
+ skip_if limited_hook_requests.blank?,
71
+ 'Limited-access hook request was not successful. Check the response for details and re-try.'
72
+
73
+ assert_target_reference_valid
74
+
75
+ check_fhir_access_elements(full_hook_requests.first, 'full-access')
76
+ check_fhir_access_elements(limited_hook_requests.first, 'limited-access')
77
+ assert_no_error_messages('The hook requests did not provide what Inferno needs to read ' \
78
+ "`#{access_level_target_reference}`. See Messages for details.")
79
+
80
+ full_fetch = target_fetch_request(full_hook_requests)
81
+ limited_fetch = target_fetch_request(limited_hook_requests)
82
+
83
+ # request_access_level_target is called unconditionally while processing these hook requests, so a
84
+ # missing fetch here means Inferno itself failed to make it, not a tester-controlled condition.
85
+ if full_fetch.blank?
86
+ raise Inferno::Exceptions::TestSuiteImplementationException.new(
87
+ 'FHIR request',
88
+ "Expected FHIR read of `#{access_level_target_reference}` not performed during the full-access " \
89
+ 'hook request.'
90
+ )
91
+ end
92
+
93
+ if limited_fetch.blank?
94
+ raise Inferno::Exceptions::TestSuiteImplementationException.new(
95
+ 'FHIR request',
96
+ "Expected FHIR read of `#{access_level_target_reference}` not performed during the " \
97
+ 'limited-access hook request.'
98
+ )
99
+ end
100
+
101
+ unless target_resource_returned?(full_fetch)
102
+ add_message('error',
103
+ "The full-access read of `#{access_level_target_reference}` did not return that " \
104
+ "resource (HTTP #{full_fetch.status}), but the full-access user is expected to be " \
105
+ 'able to read it.')
106
+ end
107
+
108
+ if limited_fetch.status.blank?
109
+ add_message('error',
110
+ "The limited-access read of `#{access_level_target_reference}` did not receive a " \
111
+ 'response, so Inferno could not determine whether access was denied.')
112
+ elsif target_resource_returned?(limited_fetch)
113
+ add_message('error',
114
+ "The limited-access read of `#{access_level_target_reference}` returned that " \
115
+ "resource (HTTP #{limited_fetch.status}), but access is expected to be denied for " \
116
+ 'the limited-access user.')
117
+ end
118
+
119
+ assert_no_error_messages("Access to `#{access_level_target_reference}` was not correctly scoped to " \
120
+ 'the user. See Messages for details.')
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,85 @@
1
+ require_relative '../../tagged_request_load_helper'
2
+ require_relative '../client_urls'
3
+ require_relative '../../../cross_suite/tags'
4
+ require_relative '../../../cross_suite/prefetch_completeness_checker'
5
+ require_relative 'access_level_target_reference'
6
+
7
+ module DaVinciCRDTestKit
8
+ module V221
9
+ class AccessLevelPrefetchScopeTest < Inferno::Test
10
+ include DaVinciCRDTestKit::TaggedRequestLoadHelper
11
+ include ClientURLs
12
+ include AccessLevelTargetReference
13
+
14
+ id :crd_v221_access_level_prefetch_scope
15
+ title 'Prefetched data access is scoped to the user'
16
+ description %(
17
+ During this test, Inferno will verify that the prefetch data included with the full-access
18
+ and limited-access hook requests is scoped to the user. If the resource referenced in the
19
+ **Target Resource Reference** input is present in the full-access request's prefetch, it must
20
+ be absent from the limited-access request's prefetch. If it is not present in the full-access
21
+ request's prefetch, the tester will confirm whether prefetch data can be limited by the
22
+ user's access level for resources of that kind.
23
+ )
24
+
25
+ verifies_requirements 'cds-hooks_3.0.0-ballot@42'
26
+
27
+ input :access_level_target_reference,
28
+ title: 'Target Resource Reference',
29
+ locked: true
30
+ output :attest_true_url
31
+ output :attest_false_url
32
+
33
+ def prefetch_contains_reference?(request_body, reference)
34
+ PrefetchCompletenessChecker.new(request_body, nil, nil).prefetched_resource_present?(reference)
35
+ end
36
+
37
+ run do
38
+ full_requests = load_tagged_requests(ACCESS_LEVEL_FULL_GROUP_TAG)
39
+ limited_requests = load_tagged_requests(ACCESS_LEVEL_LIMITED_GROUP_TAG)
40
+
41
+ skip_if full_requests.blank?,
42
+ 'Full-access hook request was not successful. Check the response for details and re-try.'
43
+ skip_if limited_requests.blank?,
44
+ 'Limited-access hook request was not successful. Check the response for details and re-try.'
45
+
46
+ assert_target_reference_valid
47
+
48
+ full_body = JSON.parse(full_requests.first.request_body)
49
+ limited_body = JSON.parse(limited_requests.first.request_body)
50
+
51
+ if prefetch_contains_reference?(full_body, access_level_target_reference)
52
+ assert !prefetch_contains_reference?(limited_body, access_level_target_reference),
53
+ "`#{access_level_target_reference}` is present in both the full-access and " \
54
+ 'limited-access prefetch data, but was expected to be restricted for the ' \
55
+ 'limited-access user.'
56
+ else
57
+ identifier = SecureRandom.hex(32)
58
+ attest_true_url = resume_pass_url_for(identifier)
59
+ attest_false_url = resume_fail_url_for(identifier)
60
+ output(attest_true_url:)
61
+ output(attest_false_url:)
62
+ wait(
63
+ identifier:,
64
+ message: <<~MESSAGE
65
+ **Prefetch Data Access Attestation**:
66
+
67
+ `#{access_level_target_reference}` was not present in the full-access request's
68
+ prefetch, so this scenario could not directly demonstrate that prefetch data is
69
+ scoped by user access.
70
+
71
+ I attest that the CRD client limits the data made available via prefetch to
72
+ what the current user is authorized to access.
73
+
74
+ [Click here](#{attest_true_url}) if the above statement is **true**.
75
+
76
+ [Click here](#{attest_false_url}) if the above statement is **false**.
77
+ MESSAGE
78
+ )
79
+ end
80
+ rescue JSON::ParserError => e
81
+ assert false, "Unable to parse a hook request body as JSON: #{e.message}"
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,92 @@
1
+ require_relative '../../client_wait_messages'
2
+ require_relative '../client_urls'
3
+ require_relative '../../tagged_request_load_helper'
4
+ require_relative '../../../cross_suite/tags'
5
+ require_relative 'access_level_target_reference'
6
+ require_relative '../../client_input_helper'
7
+
8
+ module DaVinciCRDTestKit
9
+ module V221
10
+ # Used for both the full-access and limited-access interaction tests; each usage configures a
11
+ # distinct `crd_interaction_group` tag (full vs limited) via `config`.
12
+ class AccessLevelReceiveRequestTest < Inferno::Test
13
+ include ClientURLs
14
+ include DaVinciCRDTestKit::ClientWaitMessages
15
+ include DaVinciCRDTestKit::TaggedRequestLoadHelper
16
+ include AccessLevelTargetReference
17
+
18
+ id :crd_v221_access_level_receive_request
19
+ title 'CRD client invokes a hook as a user' # updated when used to specify the kind of user
20
+
21
+ input :access_level_target_reference,
22
+ title: 'Target Resource Reference',
23
+ description: %(
24
+ Relative reference (e.g. `Observation/123`) that Inferno will read using the access
25
+ token supplied in the hook request. This resource is expected to be accessible by the
26
+ full-access user and denied to the limited-access user. If possible, it should be
27
+ within the set of prefetched data requested by Inferno.
28
+ )
29
+ input :cds_jwt_iss,
30
+ title: 'CRD JWT Issuer',
31
+ description: ClientInputHelper.locked_cds_jwt_iss_description,
32
+ locked: true
33
+ payer_organization_id_inputs
34
+ flag_as_tester_initiated_exchange
35
+
36
+ def limited_access_run?
37
+ crd_interaction_group == ACCESS_LEVEL_LIMITED_GROUP_TAG
38
+ end
39
+
40
+ def access_level_role
41
+ crd_interaction_group == ACCESS_LEVEL_FULL_GROUP_TAG ? 'full-access' : 'limited-access'
42
+ end
43
+
44
+ # only the second run has an earlier one whose content it has to match
45
+ def same_scenario_instruction
46
+ return '' unless limited_access_run?
47
+
48
+ 'Invoke the hook for the same order(s), appointment(s), or encounter used for the full-access ' \
49
+ 'user in this scenario. '
50
+ end
51
+
52
+ # wait messages are rendered as given, so keep every line flush to avoid markdown reading
53
+ # the indentation as a code block
54
+ def wait_message
55
+ <<~MESSAGE
56
+ #### Invoke a Hook as a #{access_level_role.capitalize} User
57
+
58
+ Invoke any supported hook while signed in as a **#{access_level_role}** user on one of
59
+ the two Inferno simulated CRD servers. #{same_scenario_instruction}The test will
60
+ automatically continue once Inferno has received a request and returned a response.
61
+
62
+ While processing the hook request, Inferno will use the access token from the request
63
+ to read `#{access_level_target_reference}`. That read must #{'not ' if limited_access_run?}return
64
+ the target resource.
65
+
66
+ #{service_discovery_endpoints_section}
67
+ #### Authentication and Identification
68
+
69
+ #{session_identification_message}
70
+
71
+ #### Responses
72
+
73
+ Inferno will return a mocked coverage-information response.
74
+ MESSAGE
75
+ end
76
+
77
+ run do
78
+ assert_target_reference_valid
79
+
80
+ # the limited-access run is only meaningful alongside a successful full-access one, so don't
81
+ # make the tester stage a second workflow that cannot be evaluated
82
+ if limited_access_run?
83
+ skip_if load_tagged_requests(ACCESS_LEVEL_FULL_GROUP_TAG).blank?,
84
+ 'Full-access hook request was not successful. Check the response for details and re-try.'
85
+ end
86
+
87
+ identifier = cds_jwt_iss
88
+ wait(identifier:, message: wait_message)
89
+ end
90
+ end
91
+ end
92
+ end