davinci_crd_test_kit 0.14.1 → 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 (121) 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} +0 -61
  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 +63 -38
  16. data/lib/davinci_crd_test_kit/client/endpoints/mock_service_response.rb +26 -7
  17. data/lib/davinci_crd_test_kit/client/endpoints/scenario_service_response.rb +54 -0
  18. data/lib/davinci_crd_test_kit/client/tagged_request_load_helper.rb +8 -27
  19. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/retrieve_jwks_test.rb +35 -23
  20. data/lib/davinci_crd_test_kit/client/v2.0.1/auth/token_payload_test.rb +34 -21
  21. data/lib/davinci_crd_test_kit/client/v2.0.1/cds-services-v201.json +20 -20
  22. data/lib/davinci_crd_test_kit/client/v2.0.1/client_appointment_book_group.rb +12 -10
  23. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_discharge_group.rb +12 -10
  24. data/lib/davinci_crd_test_kit/client/v2.0.1/client_encounter_start_group.rb +12 -10
  25. data/lib/davinci_crd_test_kit/client/v2.0.1/client_hooks_group.rb +5 -5
  26. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_dispatch_group.rb +12 -10
  27. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_select_group.rb +12 -10
  28. data/lib/davinci_crd_test_kit/client/v2.0.1/client_order_sign_group.rb +12 -10
  29. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_coverage_information.rb +3 -36
  30. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_external_reference.rb +3 -36
  31. data/lib/davinci_crd_test_kit/client/v2.0.1/must_support/client_card_must_support_instructions.rb +3 -36
  32. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_fetched_data_test.rb +4 -13
  33. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_request/hook_request_prefetch_equals_queried_test.rb +3 -13
  34. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/client_display_cards_attest.rb +3 -13
  35. data/lib/davinci_crd_test_kit/client/v2.0.1/verify_response/inferno_response_validation.rb +3 -13
  36. data/lib/davinci_crd_test_kit/client/v2.2.1/api/client_coverage_info_update_test.rb +1 -1
  37. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/attestation_instructions.rb +10 -0
  38. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_authorized_scope_attestation_test.rb +45 -0
  39. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_coverage_based_invocation_attestation_test.rb +44 -0
  40. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_data_element_expectations_attestation_test.rb +44 -0
  41. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_hook_invocation_logging_attestation_test.rb +43 -0
  42. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_exposure_attestation_test.rb +43 -0
  43. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_must_support_use_attestation_test.rb +41 -0
  44. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_order_sign_support_attestation_test.rb +42 -0
  45. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_prefetch_key_omission_attestation_test.rb +42 -0
  46. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_resource_identifiers_attestation_test.rb +43 -0
  47. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_response_case_distinction_attestation_test.rb +43 -0
  48. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_security_and_privacy_attestation_test.rb +43 -0
  49. data/lib/davinci_crd_test_kit/client/v2.2.1/attestations/client_workflow_integration_attestation_test.rb +44 -0
  50. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/decode_auth_token_test.rb +1 -1
  51. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/retrieve_jwks_test.rb +29 -18
  52. data/lib/davinci_crd_test_kit/client/v2.2.1/auth/token_payload_test.rb +35 -22
  53. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-prefetch-subset-v221.json +47 -47
  54. data/lib/davinci_crd_test_kit/client/v2.2.1/cds-services-v221.json +50 -50
  55. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +16 -14
  56. data/lib/davinci_crd_test_kit/client/v2.2.1/client_attestations_group.rb +49 -0
  57. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_group.rb +22 -6
  58. data/lib/davinci_crd_test_kit/client/v2.2.1/client_cross_hook_interaction_group.rb +98 -0
  59. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +12 -10
  60. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +12 -10
  61. data/lib/davinci_crd_test_kit/client/v2.2.1/client_fhir_api_group.rb +14 -12
  62. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +9 -9
  63. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +2 -1
  64. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +16 -14
  65. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +12 -10
  66. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +16 -14
  67. data/lib/davinci_crd_test_kit/client/v2.2.1/client_scenarios_group.rb +26 -0
  68. data/lib/davinci_crd_test_kit/client/v2.2.1/client_self_pay_hook_group.rb +36 -0
  69. data/lib/davinci_crd_test_kit/client/v2.2.1/client_unknown_content_hook_group.rb +34 -0
  70. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +19 -3
  71. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_card_must_support_coverage_information_test.rb +1 -1
  72. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_fhirpath_collection_as_comma_delimited_string_test.rb +4 -11
  73. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_hook_instances_unique_test.rb +1 -9
  74. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_location_address_propagation_test.rb +6 -2
  75. data/lib/davinci_crd_test_kit/client/v2.2.1/cross_hook/client_prefetch_complete_and_subset_test.rb +3 -12
  76. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/appointment_book_receive_request_test.rb +8 -89
  77. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/base_hook_invocation_receive_request_test.rb +163 -0
  78. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/cross_hooks_receive_request_test.rb +97 -0
  79. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_discharge_receive_request_test.rb +8 -90
  80. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/encounter_start_receive_request_test.rb +8 -90
  81. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_dispatch_receive_request_test.rb +8 -98
  82. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_select_receive_request_test.rb +8 -98
  83. data/lib/davinci_crd_test_kit/client/v2.2.1/invocation/order_sign_receive_request_test.rb +8 -98
  84. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_long_running_receive_request_test.rb +10 -2
  85. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +1 -1
  86. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_no_request_test.rb +30 -0
  87. data/lib/davinci_crd_test_kit/client/v2.2.1/self_pay/client_self_pay_workflow_test.rb +55 -0
  88. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_attestation_test.rb +99 -0
  89. data/lib/davinci_crd_test_kit/client/v2.2.1/unknown_content/client_unknown_content_receive_request_test.rb +62 -0
  90. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_conformance_test.rb +1 -1
  91. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_coverage_verification_test.rb +10 -2
  92. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_data_fetch_verification_test.rb +1 -1
  93. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_granted_scopes_test.rb +1 -1
  94. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +1 -1
  95. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_profiles_test.rb +1 -1
  96. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_requested_version_test.rb +1 -1
  97. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_secured_transport_test.rb +1 -1
  98. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +52 -20
  99. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/hook_response_support_coverage_information_test.rb +1 -1
  100. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/inferno_response_validation.rb +6 -3
  101. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -0
  102. data/lib/davinci_crd_test_kit/cross_suite/logical_models_override_helper.rb +30 -13
  103. data/lib/davinci_crd_test_kit/cross_suite/prefetch_profile_validation.rb +2 -0
  104. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +26 -27
  105. data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +48 -41
  106. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +3 -0
  107. data/lib/davinci_crd_test_kit/requirements/cds-hooks_3.0.0-ballot_requirements.xlsx +0 -0
  108. data/lib/davinci_crd_test_kit/requirements/davinci_crd_test_kit_requirements.csv +6 -2
  109. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +107 -107
  110. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_v221_requirements_coverage.csv +101 -97
  111. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +18 -18
  112. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +36 -32
  113. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.2.1_requirements.xlsx +0 -0
  114. data/lib/davinci_crd_test_kit/server/v2.0.1/crd_server_suite.rb +1 -1
  115. data/lib/davinci_crd_test_kit/server/v2.0.1/server_hooks_group.rb +5 -5
  116. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_standard_prefetch_expressions_test.rb +1 -2
  117. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +2 -2
  118. data/lib/davinci_crd_test_kit/server/v2.2.1/server_hooks_group.rb +5 -5
  119. data/lib/davinci_crd_test_kit/version.rb +2 -2
  120. metadata +40 -12
  121. data/config/presets/inferno_crd_server_suite_v221.json.erb +0 -94
@@ -2,7 +2,8 @@ require_relative 'client_fhir_api_group'
2
2
  require_relative 'client_hooks_group'
3
3
  require_relative 'client_cross_hook_group'
4
4
  require_relative 'client_registration_group'
5
- require_relative 'client_long_running_hook_group'
5
+ require_relative 'client_scenarios_group'
6
+ require_relative 'client_attestations_group'
6
7
  require_relative '../endpoints/cds_services_discovery_handler'
7
8
  require_relative '../../cross_suite/tags'
8
9
  require_relative 'client_urls'
@@ -114,7 +115,6 @@ module DaVinciCRDTestKit
114
115
  CRD_MESSAGE_FILTERS = [
115
116
  /\A\S+: \S+: URL value '.*' does not resolve/,
116
117
  %r{This element is not allowed by the profile http://hl7\.org/fhir/tools/StructureDefinition/CDSHooksExtensions\|1\.1\.2},
117
- /CDSHooksRequest.extension: Unrecognized property/,
118
118
  /No definition could be found for URL value/
119
119
  ].freeze
120
120
 
@@ -167,6 +167,21 @@ module DaVinciCRDTestKit
167
167
  end
168
168
  end
169
169
 
170
+ fhir_resource_validator :no_custom_extensions do
171
+ igs('hl7.fhir.us.davinci-crd#2.2.1')
172
+
173
+ validation_context do
174
+ snomedCT '731000124108' # explicit snomedCT expansion parameter
175
+ extensions [] # no extensions not in the spec
176
+ end
177
+
178
+ exclude_message do |message|
179
+ CRD_MESSAGE_FILTERS.any? do |match_template|
180
+ message.message.match?(match_template)
181
+ end
182
+ end
183
+ end
184
+
170
185
  suite_option :us_core_version,
171
186
  title: 'US Core Version',
172
187
  list_options: [
@@ -224,11 +239,12 @@ module DaVinciCRDTestKit
224
239
 
225
240
  group from: :crd_v221_client_registration
226
241
  group from: :crd_v221_client_hooks
242
+ group from: :crd_v221_client_scenarios
227
243
  group from: :crd_v221_client_cross_hook
228
- group from: :crd_v221_client_long_running_hook
229
244
  end
230
245
 
231
246
  group from: :crd_v221_client_fhir_api
247
+ group from: :crd_v221_client_attestations
232
248
  end
233
249
  end
234
250
  end
@@ -46,7 +46,7 @@ module DaVinciCRDTestKit
46
46
  end
47
47
 
48
48
  run do
49
- loaded_requests = requests_to_analyze
49
+ loaded_requests = load_requests_for_cross_hook_analysis
50
50
  skip_if loaded_requests.blank?, 'No hook requests received.'
51
51
 
52
52
  sorted_cards = sorted_cards_from_requests(loaded_requests)
@@ -1,6 +1,10 @@
1
+ require_relative '../../cross_hook_helper'
2
+
1
3
  module DaVinciCRDTestKit
2
4
  module V221
3
5
  class ClientFHIRPathCollectionAsCommaDelimitedStringTest < Inferno::Test
6
+ include CrossHookHelper
7
+
4
8
  title 'Client correctly interprets collections when substituting FHIRPath results in prefetch templates'
5
9
  id :crd_v221_client_fhir_path_collection_as_comma_delimited_string
6
10
  description <<~DESCRIPTION
@@ -32,17 +36,6 @@ module DaVinciCRDTestKit
32
36
  'Perform more complex hook requests and re-run.'
33
37
  end
34
38
 
35
- def find_completeness_tests
36
- hooks_group = self.class.parent.parent.groups.find do |group|
37
- group.id.to_s.include?('crd_v221_client_hooks')
38
- end
39
- hooks_group.groups.map do |group|
40
- group.groups.flat_map(&:tests).find do |test|
41
- test.id.to_s.include?('crd_v221_hook_request_prefetch_complete')
42
- end
43
- end.compact
44
- end
45
-
46
39
  def completeness_tests_demonstrate_collection_token_substitution?(prefetch_completeness_tests)
47
40
  results_repo = Inferno::Repositories::Results.new
48
41
  results = results_repo.current_results_for_test_session_and_runnables(test_session_id,
@@ -1,11 +1,9 @@
1
- require_relative '../../tagged_request_load_helper'
2
1
  require_relative '../../multi_request_message_helper'
3
2
  require_relative '../../../cross_suite/tags'
4
3
 
5
4
  module DaVinciCRDTestKit
6
5
  module V221
7
6
  class ClientHookInstancesUniqueTest < Inferno::Test
8
- include TaggedRequestLoadHelper
9
7
  include MultiRequestMessageHelper
10
8
 
11
9
  title 'Client does not reuse hookInstance values'
@@ -21,14 +19,8 @@ module DaVinciCRDTestKit
21
19
 
22
20
  verifies_requirements 'cds-hooks_3.0.0-ballot@25'
23
21
 
24
- config(
25
- options: {
26
- crd_test_group: DUPLICATED_HOOK_INSTANCE_TAG
27
- }
28
- )
29
-
30
22
  run do
31
- duplicated_hook_instance_requests = load_hook_requests
23
+ duplicated_hook_instance_requests = load_tagged_requests(DUPLICATED_HOOK_INSTANCE_TAG)
32
24
  reused_values = duplicated_hook_instance_requests.map.with_index do |request, request_index|
33
25
  request_body = parse_json_request_entity(request.request_body, 'Request body', request_index)
34
26
  next nil unless request_body.present?
@@ -70,7 +70,11 @@ module DaVinciCRDTestKit
70
70
 
71
71
  message_prefix = "Parent of prefetched 'Location/#{root_id}'"
72
72
  add_message('error', "Location/#{location.id}: #{message_prefix} does not conform to the CRD Location profile.")
73
- validator_response_details.each { |issue| add_message(issue.severity, "(#{message_prefix}) #{issue.message}") }
73
+ validator_response_details.each do |issue|
74
+ next if issue.filtered
75
+
76
+ add_message(issue.severity, "(#{message_prefix}) #{issue.message}")
77
+ end
74
78
  end
75
79
 
76
80
  def fetched_locations_checked_for_conformance
@@ -78,7 +82,7 @@ module DaVinciCRDTestKit
78
82
  end
79
83
 
80
84
  def loaded_requests
81
- @loaded_requests ||= requests_to_analyze
85
+ @loaded_requests ||= load_requests_for_cross_hook_analysis
82
86
  end
83
87
 
84
88
  def prefetched_location_hash
@@ -1,10 +1,12 @@
1
1
  require_relative '../../tagged_request_load_helper'
2
+ require_relative '../../cross_hook_helper'
2
3
  require_relative '../client_urls'
3
4
 
4
5
  module DaVinciCRDTestKit
5
6
  module V221
6
7
  class ClientPrefetchCompleteAndSubsetTest < Inferno::Test
7
8
  include TaggedRequestLoadHelper
9
+ include CrossHookHelper
8
10
 
9
11
  title 'Client can provide both the complete standard prefetch data set and a subset'
10
12
  id :crd_v221_client_prefetch_complete_and_subset
@@ -50,7 +52,7 @@ module DaVinciCRDTestKit
50
52
 
51
53
  run do
52
54
  subset_prefetch_requests, complete_prefetch_requests =
53
- requests_to_analyze.partition { |request| request.url.include?(PREFETCH_SUBSET_PREFIX) }
55
+ load_requests_for_cross_hook_analysis.partition { |request| request.url.include?(PREFETCH_SUBSET_PREFIX) }
54
56
  completeness_tests = find_completeness_tests
55
57
  check_for_demonstration(subset_prefetch_requests, completeness_tests, :subset)
56
58
  check_for_demonstration(complete_prefetch_requests, completeness_tests, :complete)
@@ -59,17 +61,6 @@ module DaVinciCRDTestKit
59
61
  'The client did not demonstrate both complete and subset prefetch capability. See Messages for details.'
60
62
  end
61
63
 
62
- def find_completeness_tests
63
- hooks_group = self.class.parent.parent.groups.find do |group|
64
- group.id.to_s.include?('crd_v221_client_hooks')
65
- end
66
- hooks_group.groups.map do |group|
67
- group.groups.flat_map(&:tests).find do |test|
68
- test.id.to_s.include?('crd_v221_hook_request_prefetch_complete')
69
- end
70
- end.compact
71
- end
72
-
73
64
  def check_for_demonstration(requests, completeness_tests, target_name)
74
65
  unless requests.present?
75
66
  add_message('error', "No requests made to the service endpoint requesting #{target_name} prefetch data.")
@@ -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 AppointmentBookReceiveRequestTest < Inferno::Test
6
- include ClientURLs
7
-
5
+ class AppointmentBookReceiveRequestTest < BaseHookInvocationReceiveRequestTest
8
6
  id :crd_v221_appointment_book_request
9
7
  title 'Client invokes the appointment-book hook'
10
8
  description %(
@@ -19,16 +17,7 @@ module DaVinciCRDTestKit
19
17
  by the tester by clicking on the link in the "User Action Required" dialog (NOTE: after
20
18
  5 minutes the test will become inactive and unresponsive to anything except cancelation).
21
19
  )
22
- config options: { accepts_multiple_requests: true }
23
20
 
24
- input :cds_jwt_iss,
25
- 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
- ),
31
- locked: true
32
21
  input :appointment_book_response_approach,
33
22
  title: 'Response generation approach for appointment-book',
34
23
  description: %(
@@ -60,34 +49,7 @@ module DaVinciCRDTestKit
60
49
  type: 'checkbox',
61
50
  default: ['coverage_information', 'external_reference', 'instructions'],
62
51
  optional: true,
63
- options: {
64
- list_options: [
65
- {
66
- label: 'External Reference',
67
- value: 'external_reference'
68
- },
69
- {
70
- label: 'Instructions',
71
- value: 'instructions'
72
- },
73
- {
74
- label: 'Coverage Information',
75
- value: 'coverage_information'
76
- },
77
- {
78
- label: 'Request Form Completion',
79
- value: 'request_form_completion'
80
- },
81
- {
82
- label: 'Create/Update Coverage Information',
83
- value: 'create_update_coverage_info'
84
- },
85
- {
86
- label: 'Launch SMART Application',
87
- value: 'launch_smart_app'
88
- }
89
- ]
90
- },
52
+ options: { list_options: RESPONSE_TYPE_OPTIONS },
91
53
  enable_when: { input_name: 'appointment_book_response_approach', value: 'mocked' }
92
54
  input :appointment_book_custom_response_template,
93
55
  title: 'Custom response template for appointment-book hook requests',
@@ -98,58 +60,15 @@ module DaVinciCRDTestKit
98
60
  type: 'textarea',
99
61
  optional: true,
100
62
  enable_when: { input_name: 'appointment_book_response_approach', value: 'custom' }
101
- output :continuation_url
102
-
103
- def configured_response_details
104
- if appointment_book_response_approach == 'custom'
105
- # rubocop:disable Layout/LineLength
106
- '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) ' \
107
- 'from the **Custom response template for appointment-book hook requests** input ' \
108
- 'against the incoming request to create a response.'
109
- # rubocop:enable Layout/LineLength
110
63
 
111
- else
112
- # rubocop:disable Layout/LineLength
113
- 'When responding, Inferno will [mock](https://github.com/inferno-framework/davinci-crd-test-kit/wiki/Controlling-Simulated-Responses#mocked-responses) ' \
114
- 'the following response types using the incoming request: ' \
115
- "\n - #{selected_response_types_string}"
116
- # rubocop:enable Layout/LineLength
117
- end
118
- end
64
+ private
119
65
 
120
- def selected_response_types_string
121
- if appointment_book_selected_response_types.present?
122
- appointment_book_selected_response_types.join("\n - ")
123
- else
124
- 'Coverage Information' # primary hook default
125
- end
66
+ def hook_key
67
+ 'appointment_book'
126
68
  end
127
69
 
128
- run do
129
- identifier = cds_jwt_iss
130
- continuation_url = "#{resume_pass_url}?token=#{identifier}"
131
- output(continuation_url:)
132
-
133
- wait(
134
- identifier:,
135
- message: %(
136
- **Invoke the `appointment-book` hook**:
137
-
138
- Invoke the appointment-book hook by sending requests to
139
- one or both of the two Inferno simulated CRD servers:
140
-
141
- - Complete Prefetch: `#{appointment_book_url}`
142
- - Subset Prefetch: `#{appointment_book_prefetch_subset_url}`
143
-
144
- For Inferno to recognize these requests and associate them with this session,
145
- the authentication JWT sent as a Bearer token in the Authorization header
146
- must have `#{cds_jwt_iss}` as the `iss` claim in the JWT payload.
147
-
148
- #{configured_response_details}
149
-
150
- [Click here](#{continuation_url}) when you have finished submitting requests.
151
- )
152
- )
70
+ def primary_hook?
71
+ true
153
72
  end
154
73
  end
155
74
  end
@@ -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