davinci_crd_test_kit 0.14.0 → 0.14.2

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 (166) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/{inferno_crd_server_suite.json.erb → client_against_inferno_crd_server_suite.json.erb} +0 -33
  3. data/config/presets/{ri_crd_request_generator.json.erb → client_against_ri_crd_request_generator.json.erb} +1 -14
  4. data/config/presets/client_v221_against_inferno_crd_server_suite.json.erb +84 -0
  5. data/config/presets/client_v221_against_ri_br_provider.json.erb +31 -0
  6. data/config/presets/{ri_crd_request_generator.json_v221.json.erb → client_v221_against_ri_crd_request_generator.json.erb} +1 -1
  7. data/config/presets/{inferno_crd_client_suite.json.erb → server_against_inferno_crd_client_suite.json.erb} +0 -43
  8. data/config/presets/{ri_crd_server.json.erb → server_against_ri_crd_server.json.erb} +1 -44
  9. data/config/presets/{inferno_crd_client_suite_v221.json.erb → server_v221_against_inferno_crd_client_suite.json.erb} +48 -45
  10. data/config/presets/{inferno_crd_client_suite_prefetch_subset_v221.json.erb → server_v221_against_inferno_crd_client_suite_prefetch_subset.json.erb} +0 -46
  11. data/config/presets/server_v221_against_inferno_g31_suite.json.erb +49 -0
  12. data/lib/davinci_crd_test_kit/client/cross_hook_helper.rb +26 -0
  13. data/lib/davinci_crd_test_kit/client/endpoints/custom_service_response.rb +7 -7
  14. data/lib/davinci_crd_test_kit/client/endpoints/gather_response_generation_data.rb +4 -1
  15. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +70 -39
  16. data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +26 -7
  17. data/lib/davinci_crd_test_kit/client/endpoints/mocked_card_responses/external_reference.json +1 -1
  18. data/lib/davinci_crd_test_kit/client/endpoints/mocked_card_responses/launch_smart_app.json +0 -7
  19. data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +54 -0
  20. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +8 -27
  21. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +35 -23
  22. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +34 -21
  23. data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +20 -20
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/client_appointment_book_group.rb +12 -10
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_discharge_group.rb +12 -10
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_start_group.rb +12 -10
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +5 -5
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_dispatch_group.rb +12 -10
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_select_group.rb +12 -10
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_sign_group.rb +12 -10
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_coverage_information.rb +3 -36
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_external_reference.rb +3 -36
  33. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_instructions.rb +3 -36
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_fetched_data_test.rb +4 -13
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_prefetch_equals_queried_test.rb +3 -13
  36. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +3 -13
  37. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +3 -13
  38. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +1 -1
  39. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/attestation_instructions.rb +10 -0
  40. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +45 -0
  41. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +44 -0
  42. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +44 -0
  43. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +43 -0
  44. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +43 -0
  45. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +41 -0
  46. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +42 -0
  47. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +42 -0
  48. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +43 -0
  49. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +43 -0
  50. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +43 -0
  51. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +44 -0
  52. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +1 -1
  53. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +29 -18
  54. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +35 -22
  55. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +47 -47
  56. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +50 -50
  57. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +24 -15
  58. data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +49 -0
  59. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +22 -6
  60. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +98 -0
  61. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +19 -11
  62. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +19 -11
  63. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +14 -12
  64. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +25 -5
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +3 -2
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +23 -15
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +19 -11
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +23 -15
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +6 -0
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +26 -0
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +36 -0
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +34 -0
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +24 -3
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +1 -1
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +4 -11
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +1 -9
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +6 -2
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +3 -12
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +8 -89
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +163 -0
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +97 -0
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +8 -90
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +8 -90
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +8 -98
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +8 -98
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +8 -98
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +10 -2
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +11 -6
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +2 -1
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +30 -0
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +55 -0
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +99 -0
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +62 -0
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +1 -1
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +10 -2
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +1 -1
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +1 -1
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +7 -1
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +1 -1
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +1 -1
  101. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
  102. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +54 -21
  103. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +1 -1
  104. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +6 -3
  105. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +18 -0
  106. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +30 -13
  107. data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +25 -11
  108. data/lib/davinci_crd_test_kit/cross_suite/prefetch_profile_validation.rb +2 -0
  109. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +28 -28
  110. data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +211 -43
  111. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +7 -0
  112. data/lib/davinci_crd_test_kit/requirements/cds-hooks_3.0.0-ballot_requirements.xlsx +0 -0
  113. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +6 -2
  114. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +107 -107
  115. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +101 -97
  116. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +18 -18
  117. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +43 -39
  118. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  119. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook.rb +3 -3
  120. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook_no_special_requests.rb +17 -0
  121. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook_with_bad_auth.rb +14 -0
  122. data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +24 -6
  123. data/lib/davinci_crd_test_kit/server/server_hook_helper.rb +2 -2
  124. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_server_suite.rb +1 -1
  125. data/lib/davinci_crd_test_kit/server/v2.0.1/server_hooks_group.rb +5 -5
  126. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_server_suite.rb +3 -0
  127. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_standard_prefetch_expressions_test.rb +165 -0
  128. data/lib/davinci_crd_test_kit/server/v2.2.1/interaction/server_invoke_hook_single_request_test.rb +22 -0
  129. data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +10 -102
  130. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +3 -2
  131. data/lib/davinci_crd_test_kit/server/v2.2.1/server_discovery_group.rb +2 -0
  132. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +10 -97
  133. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +10 -97
  134. data/lib/davinci_crd_test_kit/server/v2.2.1/server_hooks_group.rb +5 -5
  135. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +10 -103
  136. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +12 -116
  137. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +12 -121
  138. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_response_group.rb +23 -0
  139. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_info_reason_test.rb +108 -0
  140. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_not_found_group.rb +116 -0
  141. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_active_coverage_group.rb +115 -0
  142. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_member_found_group.rb +117 -0
  143. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_group.rb +121 -0
  144. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_invoke_test.rb +22 -0
  145. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +1 -0
  146. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +1 -0
  147. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +1 -0
  148. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/additional_orders_validation_test.rb +78 -35
  149. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_card_absence_test.rb +76 -0
  150. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_validation_test.rb +70 -124
  151. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/create_or_update_coverage_info_response_validation_test.rb +83 -39
  152. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/external_reference_card_validation_test.rb +59 -17
  153. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/form_completion_response_validation_test.rb +80 -45
  154. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/hook_request_resource_resolution.rb +37 -0
  155. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/instructions_card_received_test.rb +57 -6
  156. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/launch_smart_app_card_validation_test.rb +56 -17
  157. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/propose_alternate_request_card_validation_test.rb +52 -25
  158. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb +17 -51
  159. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_cds_hooks_elements_test.rb +1 -1
  160. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_configuration_test.rb +1 -1
  161. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_context_test.rb +1 -1
  162. data/lib/davinci_crd_test_kit/version.rb +2 -2
  163. metadata +54 -16
  164. data/config/presets/inferno_crd_server_suite_v221.json.erb +0 -94
  165. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/card_optional_fields_validation_test.rb +0 -57
  166. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_received_test.rb +0 -65
@@ -0,0 +1,163 @@
1
+ require_relative '../client_urls'
2
+ require_relative '../../../cross_suite/cards_identification'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class BaseHookInvocationReceiveRequestTest < Inferno::Test
7
+ include ClientURLs
8
+
9
+ RESPONSE_TYPE_OPTIONS = [
10
+ {
11
+ label: 'External Reference (card)',
12
+ value: 'external_reference'
13
+ },
14
+ {
15
+ label: 'Instructions (card)',
16
+ value: 'instructions'
17
+ },
18
+ {
19
+ label: 'Coverage Information (systemAction)',
20
+ value: 'coverage_information'
21
+ },
22
+ {
23
+ label: 'Request Form Completion (card)',
24
+ value: 'request_form_completion'
25
+ },
26
+ {
27
+ label: 'Create/Update Coverage Information (card)',
28
+ value: 'create_update_coverage_info'
29
+ },
30
+ {
31
+ label: 'Launch SMART Application (card)',
32
+ value: 'launch_smart_app'
33
+ }
34
+ ].freeze
35
+
36
+ ORDER_RESPONSE_TYPE_OPTIONS = (RESPONSE_TYPE_OPTIONS + [
37
+ {
38
+ label: 'Propose Alternate Request (card)',
39
+ value: 'propose_alternate_request'
40
+ },
41
+ {
42
+ label: 'Additional Orders as Companions/Prerequisites (card)',
43
+ value: 'companions_prerequisites'
44
+ }
45
+ ]).freeze
46
+
47
+ config options: { accepts_multiple_requests: true }
48
+
49
+ input :cds_jwt_iss,
50
+ title: 'CRD JWT Issuer',
51
+ description: %(
52
+ Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
53
+ request sent as the Bearer token in the `Authorization` header.
54
+ Run or re-run the "Registration" group to set or change this value.
55
+ ),
56
+ locked: true
57
+ output :continuation_url
58
+
59
+ def hook_key
60
+ raise NotImplementedError, "#{self.class} must implement #hook_key"
61
+ end
62
+
63
+ def primary_hook?
64
+ raise NotImplementedError, "#{self.class} must implement #primary_hook?"
65
+ end
66
+
67
+ def hook_slug
68
+ hook_key.to_s.tr('_', '-')
69
+ end
70
+
71
+ def response_approach
72
+ send(:"#{hook_key}_response_approach")
73
+ end
74
+
75
+ def selected_response_types
76
+ send(:"#{hook_key}_selected_response_types")
77
+ end
78
+
79
+ def configured_response_details
80
+ if response_approach == 'custom'
81
+ # rubocop:disable Layout/LineLength
82
+ 'When responding, Inferno will evaluate the provided [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses) ' \
83
+ "from the **Custom response template for #{hook_slug} hook requests** input " \
84
+ 'against the incoming request to create a response.'
85
+ else
86
+ 'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
87
+ 'the following response types using the incoming request: ' \
88
+ "\n - #{selected_response_types_string}"
89
+ # rubocop:enable Layout/LineLength
90
+ end
91
+ end
92
+
93
+ def selected_response_types_string
94
+ response_types =
95
+ if selected_response_types.present?
96
+ selected_response_types
97
+ else
98
+ # matches the hook's default response type
99
+ primary_hook? ? [DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE] : [DaVinciCRDTestKit::CardsIdentification::INSTRUCTIONS_RESPONSE_TYPE]
100
+ end.map do |response_type|
101
+ if response_type == DaVinciCRDTestKit::CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE
102
+ "#{response_type}_action"
103
+ else
104
+ "#{response_type}_card"
105
+ end
106
+ end
107
+
108
+ format_responded_response_types(response_types)
109
+ end
110
+
111
+ def format_responded_response_types(response_types)
112
+ response_types
113
+ .map do |response_type|
114
+ DaVinciCRDTestKit::CardsIdentification.humanize_response_type(response_type)
115
+ .sub('Card', '(card)')
116
+ .sub('Action', '(systemAction)')
117
+ end.join("\n - ")
118
+ end
119
+
120
+ def invoke_heading
121
+ "Invoke the `#{hook_slug}` hook"
122
+ end
123
+
124
+ def invoke_intro
125
+ "Invoke #{hook_slug} hook by sending requests to one or both of the two Inferno simulated CRD servers:"
126
+ end
127
+
128
+ def complete_prefetch_url
129
+ send(:"#{hook_key}_url")
130
+ end
131
+
132
+ def subset_prefetch_url
133
+ send(:"#{hook_key}_prefetch_subset_url")
134
+ end
135
+
136
+ run do
137
+ identifier = cds_jwt_iss
138
+ continuation_url = "#{resume_pass_url}?token=#{identifier}"
139
+ output(continuation_url:)
140
+
141
+ wait(
142
+ identifier:,
143
+ message: %(
144
+ **#{invoke_heading}**:
145
+
146
+ #{invoke_intro}
147
+
148
+ - Complete Prefetch: `#{complete_prefetch_url}`
149
+ - Subset Prefetch: `#{subset_prefetch_url}`
150
+
151
+ For Inferno to recognize these requests and associate them with this session,
152
+ the authentication JWT sent as a Bearer token in the Authorization header
153
+ must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
154
+
155
+ #{configured_response_details}
156
+
157
+ [Click here](#{continuation_url}) when you have finished submitting requests.
158
+ )
159
+ )
160
+ end
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,97 @@
1
+ require_relative 'base_hook_invocation_receive_request_test'
2
+
3
+ module DaVinciCRDTestKit
4
+ module V221
5
+ class CrossHooksReceiveRequestTest < BaseHookInvocationReceiveRequestTest
6
+ id :crd_v221_cross_hooks_request
7
+ title 'Client invokes any hook'
8
+ description %(
9
+ During this test, Inferno will wait while the client makes one or more [hook](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/hooks.html)
10
+ requests against Inferno's simulated CRD servers. Inferno will respond
11
+ based on the response configuration provided when running the test.
12
+ For more details on how Inferno's simulated CRD servers behave during
13
+ hook invocation see the [simulated CRD server](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Client-Details#crd-server-simulation)
14
+ documentation.
15
+
16
+ Inferno will pause and wait for inbound requests until told explicitly to continue
17
+ by the tester by clicking on the link in the "User Action Required" dialog (NOTE: after
18
+ 5 minutes the test will become inactive and unresponsive to anything except cancelation).
19
+ )
20
+
21
+ input :cross_hooks_response_approach,
22
+ title: 'Response generation approach for all hooks',
23
+ description: %(
24
+ Determines how Inferno will generate response for all
25
+ hook invocations.
26
+ ),
27
+ type: 'radio',
28
+ default: 'mocked',
29
+ options: {
30
+ list_options: [
31
+ {
32
+ label: 'Create simple mocks based on selected response types',
33
+ value: 'mocked'
34
+ },
35
+ {
36
+ label: 'Generate responses based on a tester-provided template',
37
+ value: 'custom'
38
+ }
39
+ ]
40
+ }
41
+ input :cross_hooks_selected_response_types,
42
+ title: 'Response types to return from all hook requests',
43
+ description: %(
44
+ Select the CRD response types that the simulated Inferno CRD server will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses)
45
+ when responding to hook invocations. If no types are selected, Inferno will mock and return
46
+ a [Coverage Information](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/cards.html#coverage-information-response-type)
47
+ response.
48
+ ),
49
+ type: 'checkbox',
50
+ default: ['coverage_information', 'external_reference', 'instructions'],
51
+ optional: true,
52
+ options: { list_options: ORDER_RESPONSE_TYPE_OPTIONS },
53
+ enable_when: { input_name: 'cross_hooks_response_approach', value: 'mocked' }
54
+ input :cross_hooks_custom_response_template,
55
+ title: 'Custom response template for all hook requests',
56
+ description: %(
57
+ Provide a [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses)
58
+ in JSON form for Inferno to use when responding to hook invocations.
59
+ ),
60
+ type: 'textarea',
61
+ optional: true,
62
+ enable_when: { input_name: 'cross_hooks_response_approach', value: 'custom' }
63
+
64
+ private
65
+
66
+ def hook_key
67
+ 'cross_hooks'
68
+ end
69
+
70
+ def hook_slug
71
+ 'all'
72
+ end
73
+
74
+ def primary_hook?
75
+ true
76
+ end
77
+
78
+ def invoke_heading
79
+ 'Invoke any hook'
80
+ end
81
+
82
+ def invoke_intro
83
+ "Invoke any hook by sending requests to\n " \
84
+ "one or both of the two Inferno simulated CRD servers\n " \
85
+ 'discoverable at the following endpoints:'
86
+ end
87
+
88
+ def complete_prefetch_url
89
+ discovery_url
90
+ end
91
+
92
+ def subset_prefetch_url
93
+ prefetch_subset_discovery_url
94
+ end
95
+ end
96
+ end
97
+ end
@@ -1,10 +1,8 @@
1
- require_relative '../client_urls'
1
+ require_relative 'base_hook_invocation_receive_request_test'
2
2
 
3
3
  module DaVinciCRDTestKit
4
4
  module V221
5
- class EncounterDischargeReceiveRequestTest < Inferno::Test
6
- include ClientURLs
7
-
5
+ class EncounterDischargeReceiveRequestTest < BaseHookInvocationReceiveRequestTest
8
6
  id :crd_v221_encounter_discharge_request
9
7
  title 'Client invokes the encounter-discharge hook'
10
8
  description %(
@@ -20,16 +18,6 @@ module DaVinciCRDTestKit
20
18
  5 minutes the test will become inactive and unresponsive to anything except cancelation).
21
19
  )
22
20
 
23
- config options: { accepts_multiple_requests: true }
24
-
25
- input :cds_jwt_iss,
26
- title: 'CRD JWT Issuer',
27
- description: %(
28
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
29
- request sent as the Bearer token in the `Authorization` header.
30
- Run or re-run the "Registration" group to set or change this value.
31
- ),
32
- locked: true
33
21
  input :encounter_discharge_response_approach,
34
22
  title: 'Response generation approach for encounter-discharge',
35
23
  description: %(
@@ -61,34 +49,7 @@ module DaVinciCRDTestKit
61
49
  type: 'checkbox',
62
50
  default: ['coverage_information', 'external_reference', 'instructions'],
63
51
  optional: true,
64
- options: {
65
- list_options: [
66
- {
67
- label: 'External Reference',
68
- value: 'external_reference'
69
- },
70
- {
71
- label: 'Instructions',
72
- value: 'instructions'
73
- },
74
- {
75
- label: 'Coverage Information',
76
- value: 'coverage_information'
77
- },
78
- {
79
- label: 'Request Form Completion',
80
- value: 'request_form_completion'
81
- },
82
- {
83
- label: 'Create/Update Coverage Information',
84
- value: 'create_update_coverage_info'
85
- },
86
- {
87
- label: 'Launch SMART Application',
88
- value: 'launch_smart_app'
89
- }
90
- ]
91
- },
52
+ options: { list_options: RESPONSE_TYPE_OPTIONS },
92
53
  enable_when: { input_name: 'encounter_discharge_response_approach', value: 'mocked' }
93
54
  input :encounter_discharge_custom_response_template,
94
55
  title: 'Custom response template for encounter-discharge hook requests',
@@ -99,58 +60,15 @@ module DaVinciCRDTestKit
99
60
  type: 'textarea',
100
61
  optional: true,
101
62
  enable_when: { input_name: 'encounter_discharge_response_approach', value: 'custom' }
102
- output :continuation_url
103
-
104
- def configured_response_details
105
- if encounter_discharge_response_approach == 'custom'
106
- # rubocop:disable Layout/LineLength
107
- 'When responding, Inferno will evaluate the provided [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses) ' \
108
- 'from the **Custom response template for encounter-discharge hook requests** input ' \
109
- 'against the incoming request to create a response.'
110
- # rubocop:enable Layout/LineLength
111
63
 
112
- else
113
- # rubocop:disable Layout/LineLength
114
- 'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
115
- 'the following response types using the incoming request: ' \
116
- "\n - #{selected_response_types_string}"
117
- # rubocop:enable Layout/LineLength
118
- end
119
- end
64
+ private
120
65
 
121
- def selected_response_types_string
122
- if encounter_discharge_selected_response_types.present?
123
- encounter_discharge_selected_response_types.join("\n - ")
124
- else
125
- 'Instructions' # secondary hook default
126
- end
66
+ def hook_key
67
+ 'encounter_discharge'
127
68
  end
128
69
 
129
- run do
130
- identifier = cds_jwt_iss
131
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
132
- output(continuation_url:)
133
-
134
- wait(
135
- identifier:,
136
- message: %(
137
- **Invoke the `encounter-discharge` hook**:
138
-
139
- Invoke the encounter-discharge hook by sending requests to
140
- one or both of the two Inferno simulated CRD servers:
141
-
142
- - Complete Prefetch: `#{encounter_discharge_url}`
143
- - Subset Prefetch: `#{encounter_discharge_prefetch_subset_url}`
144
-
145
- For Inferno to recognize these requests and associate them with this session,
146
- the authentication JWT sent as a Bearer token in the Authorization header
147
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
148
-
149
- #{configured_response_details}
150
-
151
- [Click here](#{continuation_url}) when you have finished submitting requests.
152
- )
153
- )
70
+ def primary_hook?
71
+ false
154
72
  end
155
73
  end
156
74
  end
@@ -1,10 +1,8 @@
1
- require_relative '../client_urls'
1
+ require_relative 'base_hook_invocation_receive_request_test'
2
2
 
3
3
  module DaVinciCRDTestKit
4
4
  module V221
5
- class EncounterStartReceiveRequestTest < Inferno::Test
6
- include ClientURLs
7
-
5
+ class EncounterStartReceiveRequestTest < BaseHookInvocationReceiveRequestTest
8
6
  id :crd_v221_encounter_start_request
9
7
  title 'Client invokes the encounter-start hook'
10
8
  description %(
@@ -20,16 +18,6 @@ module DaVinciCRDTestKit
20
18
  5 minutes the test will become inactive and unresponsive to anything except cancelation).
21
19
  )
22
20
 
23
- config options: { accepts_multiple_requests: true }
24
-
25
- input :cds_jwt_iss,
26
- title: 'CRD JWT Issuer',
27
- description: %(
28
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
29
- request sent as the Bearer token in the `Authorization` header.
30
- Run or re-run the "Registration" group to set or change this value.
31
- ),
32
- locked: true
33
21
  input :encounter_start_response_approach,
34
22
  title: 'Response generation approach for encounter-start',
35
23
  description: %(
@@ -61,34 +49,7 @@ module DaVinciCRDTestKit
61
49
  type: 'checkbox',
62
50
  default: ['coverage_information', 'external_reference', 'instructions'],
63
51
  optional: true,
64
- options: {
65
- list_options: [
66
- {
67
- label: 'External Reference',
68
- value: 'external_reference'
69
- },
70
- {
71
- label: 'Instructions',
72
- value: 'instructions'
73
- },
74
- {
75
- label: 'Coverage Information',
76
- value: 'coverage_information'
77
- },
78
- {
79
- label: 'Request Form Completion',
80
- value: 'request_form_completion'
81
- },
82
- {
83
- label: 'Create/Update Coverage Information',
84
- value: 'create_update_coverage_info'
85
- },
86
- {
87
- label: 'Launch SMART Application',
88
- value: 'launch_smart_app'
89
- }
90
- ]
91
- },
52
+ options: { list_options: RESPONSE_TYPE_OPTIONS },
92
53
  enable_when: { input_name: 'encounter_start_response_approach', value: 'mocked' }
93
54
  input :encounter_start_custom_response_template,
94
55
  title: 'Custom response template for encounter-start hook requests',
@@ -99,58 +60,15 @@ module DaVinciCRDTestKit
99
60
  type: 'textarea',
100
61
  optional: true,
101
62
  enable_when: { input_name: 'encounter_start_response_approach', value: 'custom' }
102
- output :continuation_url
103
-
104
- def configured_response_details
105
- if encounter_start_response_approach == 'custom'
106
- # rubocop:disable Layout/LineLength
107
- 'When responding, Inferno will evaluate the provided [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses) ' \
108
- 'from the **Custom response template for encounter-start hook requests** input ' \
109
- 'against the incoming request to create a response.'
110
- # rubocop:enable Layout/LineLength
111
63
 
112
- else
113
- # rubocop:disable Layout/LineLength
114
- 'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
115
- 'the following response types using the incoming request: ' \
116
- "\n - #{selected_response_types_string}"
117
- # rubocop:enable Layout/LineLength
118
- end
119
- end
64
+ private
120
65
 
121
- def selected_response_types_string
122
- if encounter_start_selected_response_types.present?
123
- encounter_start_selected_response_types.join("\n - ")
124
- else
125
- 'Instructions' # secondary hook default
126
- end
66
+ def hook_key
67
+ 'encounter_start'
127
68
  end
128
69
 
129
- run do
130
- identifier = cds_jwt_iss
131
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
132
- output(continuation_url:)
133
-
134
- wait(
135
- identifier:,
136
- message: %(
137
- **Invoke the `encounter-start` hook**:
138
-
139
- Invoke the encounter-start hook by sending requests to
140
- one or both of the two Inferno simulated CRD servers:
141
-
142
- - Complete Prefetch: `#{encounter_start_url}`
143
- - Subset Prefetch: `#{encounter_start_prefetch_subset_url}`
144
-
145
- For Inferno to recognize these requests and associate them with this session,
146
- the authentication JWT sent as a Bearer token in the Authorization header
147
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
148
-
149
- #{configured_response_details}
150
-
151
- [Click here](#{continuation_url}) when you have finished submitting requests.
152
- )
153
- )
70
+ def primary_hook?
71
+ false
154
72
  end
155
73
  end
156
74
  end
@@ -1,10 +1,8 @@
1
- require_relative '../client_urls'
1
+ require_relative 'base_hook_invocation_receive_request_test'
2
2
 
3
3
  module DaVinciCRDTestKit
4
4
  module V221
5
- class OrderDispatchReceiveRequestTest < Inferno::Test
6
- include ClientURLs
7
-
5
+ class OrderDispatchReceiveRequestTest < BaseHookInvocationReceiveRequestTest
8
6
  id :crd_v221_order_dispatch_request
9
7
  title 'Client invokes the order-dispatch hook'
10
8
  description %(
@@ -20,16 +18,6 @@ module DaVinciCRDTestKit
20
18
  5 minutes the test will become inactive and unresponsive to anything except cancelation).
21
19
  )
22
20
 
23
- config options: { accepts_multiple_requests: true }
24
-
25
- input :cds_jwt_iss,
26
- title: 'CRD JWT Issuer',
27
- description: %(
28
- Value of the `iss` claim that must be present in the JWT used to authorize the client's hook
29
- request sent as the Bearer token in the `Authorization` header.
30
- Run or re-run the "Registration" group to set or change this value.
31
- ),
32
- locked: true
33
21
  input :order_dispatch_response_approach,
34
22
  title: 'Response generation approach for order-dispatch',
35
23
  description: %(
@@ -61,42 +49,7 @@ module DaVinciCRDTestKit
61
49
  type: 'checkbox',
62
50
  default: ['coverage_information', 'external_reference', 'instructions'],
63
51
  optional: true,
64
- options: {
65
- list_options: [
66
- {
67
- label: 'External Reference',
68
- value: 'external_reference'
69
- },
70
- {
71
- label: 'Instructions',
72
- value: 'instructions'
73
- },
74
- {
75
- label: 'Coverage Information',
76
- value: 'coverage_information'
77
- },
78
- {
79
- label: 'Request Form Completion',
80
- value: 'request_form_completion'
81
- },
82
- {
83
- label: 'Create/Update Coverage Information',
84
- value: 'create_update_coverage_info'
85
- },
86
- {
87
- label: 'Launch SMART Application',
88
- value: 'launch_smart_app'
89
- },
90
- {
91
- label: 'Propose Alternate Request',
92
- value: 'propose_alternate_request'
93
- },
94
- {
95
- label: 'Additional Orders as Companions/Prerequisites',
96
- value: 'companions_prerequisites'
97
- }
98
- ]
99
- },
52
+ options: { list_options: ORDER_RESPONSE_TYPE_OPTIONS },
100
53
  enable_when: { input_name: 'order_dispatch_response_approach', value: 'mocked' }
101
54
  input :order_dispatch_custom_response_template,
102
55
  title: 'Custom response template for order-dispatch hook requests',
@@ -107,58 +60,15 @@ module DaVinciCRDTestKit
107
60
  type: 'textarea',
108
61
  optional: true,
109
62
  enable_when: { input_name: 'order_dispatch_response_approach', value: 'custom' }
110
- output :continuation_url
111
63
 
112
- def configured_response_details
113
- if order_dispatch_response_approach == 'custom'
114
- # rubocop:disable Layout/LineLength
115
- 'When responding, Inferno will evaluate the provided [custom response template](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#tester-directed-custom-responses) ' \
116
- 'from the **Custom response template for order-dispatch hook requests** input ' \
117
- 'against the incoming request to create a response.'
118
- # rubocop:enable Layout/LineLength
64
+ private
119
65
 
120
- else
121
- # rubocop:disable Layout/LineLength
122
- 'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
123
- 'the following response types using the incoming request: ' \
124
- "\n - #{selected_response_types_string}"
125
- # rubocop:enable Layout/LineLength
126
- end
66
+ def hook_key
67
+ 'order_dispatch'
127
68
  end
128
69
 
129
- def selected_response_types_string
130
- if order_dispatch_selected_response_types.present?
131
- order_dispatch_selected_response_types.join("\n - ")
132
- else
133
- 'Coverage Information' # primary hook default
134
- end
135
- end
136
-
137
- run do
138
- identifier = cds_jwt_iss
139
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
140
- output(continuation_url:)
141
-
142
- wait(
143
- identifier:,
144
- message: %(
145
- **Invoke the `order-dispatch` hook**:
146
-
147
- Invoke the order-dispatch hook by sending requests to
148
- one or both of the two Inferno simulated CRD servers:
149
-
150
- - Complete Prefetch: `#{order_dispatch_url}`
151
- - Subset Prefetch: `#{order_dispatch_prefetch_subset_url}`
152
-
153
- For Inferno to recognize these requests and associate them with this session,
154
- the authentication JWT sent as a Bearer token in the Authorization header
155
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
156
-
157
- #{configured_response_details}
158
-
159
- [Click here](#{continuation_url}) when you have finished submitting requests.
160
- )
161
- )
70
+ def primary_hook?
71
+ true
162
72
  end
163
73
  end
164
74
  end