Class: DaVinciCRDTestKit::V221::ServiceResponseValidationTest

Inherits:
Inferno::Test
  • Object
show all
Includes:
CardsValidation, ResponseLogicalModelValidation, ServerHookHelper
Defined in:
lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb

Constant Summary collapse

SYSTEM_ACTIONS_HOOK_NAMES =
['appointment-book', 'order-sign', 'order-dispatch'].freeze

Constants included from ResponseLogicalModelValidation

ResponseLogicalModelValidation::ACTION_TYPE_TO_LOGICAL_MODEL, ResponseLogicalModelValidation::CARD_TYPE_TO_LOGICAL_MODEL, ResponseLogicalModelValidation::CRD_LOGICAL_MODEL_BASE, ResponseLogicalModelValidation::CRD_RESPONSE_BASE_LOGICAL_MODEL

Constants included from CardsIdentification

CardsIdentification::ADDITIONAL_ORDERS_EXPECTED_RESOURCE_TYPES, CardsIdentification::ADDITIONAL_ORDERS_RESPONSE_TYPE, CardsIdentification::COVERAGE_INFORMATION_RESPONSE_TYPE, CardsIdentification::COVERAGE_INFO_CONFIGURATION_CODE, CardsIdentification::COVERAGE_INFO_EXPECTED_RESOURCE_TYPES, CardsIdentification::COVERAGE_INFO_EXT_URL, CardsIdentification::CREATE_OR_UPDATE_COVERAGE_RESPONSE_TYPE, CardsIdentification::EXTERNAL_REFERENCE_RESPONSE_TYPE, CardsIdentification::FORM_COMPLETION_RESPONSE_TYPE, CardsIdentification::INSTRUCTIONS_RESPONSE_TYPE, CardsIdentification::LAUNCH_SMART_APP_RESPONSE_TYPE, CardsIdentification::PROPOSE_ALTERNATIVE_REQUEST_EXPECTED_RESOURCE_TYPES, CardsIdentification::PROPOSE_ALTERNATIVE_REQUEST_RESPONSE_TYPE

Constants included from ProfilesAndResourceTypes

ProfilesAndResourceTypes::ORDER_OR_ENCOUNTER_RESOURCE_CLASSES, ProfilesAndResourceTypes::ORDER_RESOURCE_CLASSES, ProfilesAndResourceTypes::ORDER_RESOURCE_TYPES

Constants included from RequestsLogicalModelValidation

RequestsLogicalModelValidation::CRD_CDS_HOOK_REQUEST_MODEL_URL, RequestsLogicalModelValidation::PERFORMER_ALLOWED_RESOURCE_TYPES, RequestsLogicalModelValidation::USER_ID_ALLOWED_RESOURCE_TYPES

Constants included from CardsValidation

CardsValidation::HOOKS

Instance Method Summary collapse

Methods included from ServerHookHelper

#discovered_service_id_for_hook, #identify_hook, #target_service_id, #tested_hook_name

Methods included from ResponseLogicalModelValidation

#add_messages_not_excluded, #check_action_target, #check_questionnaire_actions, #check_required_action_type, #logical_model_entity_label, #logical_model_extension_issue?, #logical_model_url, #manually_check_action_resources_for_order_profile_conformance, #manually_check_action_specific_errors, #manually_check_additional_orders_errors, #manually_check_card_specific_errors, #manually_check_coverage_information_errors, #manually_check_form_completion_action_errors, #manually_check_form_completion_errors, #manually_check_propose_alternative_errors, #manually_check_update_coverage_action_errors, #perform_response_logical_model_validation, #validate_card_against_logical_model, #validate_system_action_against_logical_model

Methods included from LogicalModelsOverrideHelper

#allowed_resource_type?, #check_appointment_conformance, #check_order_like_resource_conformance, #check_resource_conformance_to_coverage_profile, #check_resource_conformance_to_order_or_encounter_profile, #check_resource_conformance_to_order_profile, #check_resource_conformance_to_questionnaire_task_profile, #check_resource_type_and_validate, #local_reference?, #manually_check_appointment_validation_errors, #parse_action_resource, #primary_performer_type?, #referenced_resource_present_in_bundle?, #reject_resource_issues, #resolved_participant_patient_slice_issue?, #resolved_participant_primary_performer_slice_issue?

Methods included from CardsIdentification

#additional_orders_response_type?, #cache_sorted_cards, #check_action_type, #coverage_info_card_type?, #coverage_info_configuration_disabled?, #coverage_info_content, #coverage_info_response?, #coverage_info_system_action_type?, #coverage_information_response_type?, #create_or_update_coverage_action_response_type?, #create_or_update_coverage_card_response_type?, #create_questionnaire_action_response_type?, #disable_coverage_info_configuration!, #extension_url, #external_reference_response_type?, #extract_coverage_information_extensions, #form_completion_action_response_type?, #form_completion_card_response_type?, #form_completion_task_questionnaire?, #hook_instances_from_requests, #identify_action_type, #identify_card_type, #initialize_sorted_cards_hash, #instructions_response_type?, #launch_smart_app_response_type?, #list_card_types_in_requests, #propose_alternative_request_response_type?, #sort_card_types_from_request, #sorted_cards_cached?, #sorted_cards_from_cache, #sorted_cards_from_requests

Methods included from HookRequestFieldValidation

#hook_request_context_check, #hook_request_optional_fields_check, #hook_request_prefetch_check, #hook_request_required_fields_check, #json_parse, #no_error_validation

Methods included from ProfilesAndResourceTypes

#structure_definition_map, #structure_definition_map_v201, #structure_definition_map_v221

Methods included from ServerBaseURLs

#client_fhir_base_url, #fhir_url, #instance_url, #search_url

Methods included from BaseURLs

#inferno_base_url, #resume_fail_url, #resume_pass_url

Methods included from RequestsLogicalModelValidation

#validate_request_against_logical_model

Methods included from SuggestionActionsValidation

#action_fields_validation, #action_resource_type_check, #actions_check

Methods included from CardsValidation

#additional_orders_check, #all_requests, #card_indicator_check, #card_links_check, #card_optional_fields, #card_override_reasons_check, #card_required_fields, #card_selection_behavior_check, #card_source_check, #card_source_topic_check, #card_suggestions_check, #card_summary_check, #cards_check, #create_or_update_coverage_check, #external_reference_card_check, #form_completion_check, #link_required_fields, #no_links_check, #override_reasons_required_fields, #perform_cards_validation, #process_suggestion, #propose_alternate_request_check, #response_label, #smart_app_card_check, #source_required_fields, #source_topic_required_fields, #valid_card_with_optionals?, #validate_and_process_actions

Instance Method Details

#perform_system_actions_validation(system_actions, response_index) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb', line 52

def perform_system_actions_validation(system_actions, response_index)
  if SYSTEM_ACTIONS_HOOK_NAMES.include?(invoked_hook) && system_actions.nil?
    msg = "Server response #{response_index + 1} did not have the `systemActions` field, " \
          "which must be present for the `#{invoked_hook}` hook."
    add_message('error', msg)
  end
  return if system_actions.nil?

  unless system_actions.is_a?(Array)
    add_message('error', "`systemActions` of server response #{response_index + 1} is not an array.")
    return
  end
  system_actions_check(system_actions)
end

#system_actions_check(system_actions) ⇒ Object



44
45
46
47
48
49
50
# File 'lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb', line 44

def system_actions_check(system_actions)
  system_actions.each do |action|
    current_error_count = messages.count { |msg| msg[:type] == 'error' }
    action_fields_validation(action, ig_version: 'v221')
    valid_system_actions << action if current_error_count == messages.count { |msg| msg[:type] == 'error' }
  end
end

#valid_cardsObject



36
37
38
# File 'lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb', line 36

def valid_cards
  @valid_cards ||= []
end

#valid_system_actionsObject



40
41
42
# File 'lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb', line 40

def valid_system_actions
  @valid_system_actions ||= []
end