Class: DaVinciCRDTestKit::ServiceResponseValidationTest
- Inherits:
-
Inferno::Test
- Object
- Inferno::Test
- DaVinciCRDTestKit::ServiceResponseValidationTest
- Includes:
- CardsValidation, ServerHookHelper
- Defined in:
- lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb
Constant Summary collapse
- SYSTEM_ACTIONS_HOOK_NAMES =
['appointment-book', 'order-sign'].freeze
Constants included from CardsValidation
Instance Method Summary collapse
- #perform_system_actions_validation(system_actions, response_index) ⇒ Object
- #system_actions_check(system_actions) ⇒ Object
- #valid_cards ⇒ Object
- #valid_system_actions ⇒ Object
Methods included from ServerHookHelper
#discovered_service_id_for_hook, #identify_hook, #target_service_id, #tested_hook_name
Methods included from CardsValidation
#all_requests, #card_indicator_check, #card_link_type_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, #extract_all_valid_cards_from_hooks_responses, #extract_valid_cards_with_links_from_hooks_responses, #link_required_fields, #override_reasons_required_fields, #perform_cards_validation, #process_suggestion, #response_label, #source_required_fields, #source_topic_required_fields, #valid_card_with_optionals?, #validate_and_process_actions
Methods included from SuggestionActionsValidation
#action_fields_validation, #action_required_fields, #action_resource_field_validation, #action_resource_id_field_validation, #action_resource_type_check, #action_type_field_validation, #actions_check, #create_or_update_action_check, #delete_action_check, #draft_orders_bundle_entry_refs, #extract_resource_types_by_action
Methods included from ServerHookRequestValidation
Methods included from HookRequestFieldValidation
#appointment_book_context_check, #bundle_entries_check, #check_patient_scope_requirement, #common_context_fields, #context_optional_fields_by_hook, #context_required_fields_by_hook, #context_selections_check, #context_user_types_by_hook, #context_validate_optional_fields, #encounter_start_or_discharge_context_check, #fhir_auth_fields_valid?, #fhir_authorization_required_fields, #hook_optional_fields, #hook_request_context_check, #hook_request_fhir_auth_check, #hook_request_optional_fields_check, #hook_request_prefetch_check, #hook_request_required_fields_check, #hook_required_fields, #hook_specific_context_check, #hook_user_type_check, #id_only_fields_check, #json_parse, #no_error_validation, #optional_field_resource_types, #order_dispatch_context_check, #order_select_or_sign_context_check, #parse_fhir_bundle_from_context, #query_and_validate_id_field, #request_number, #resource_reference_check, #status_check, #structure_definition_map, #valid_id_format?, #valid_reference_format?, #valid_url?, #validate_hash_fields, #validate_prefetch_coverage, #validate_prefetch_resource, #validate_presence_and_type
Instance Method Details
#perform_system_actions_validation(system_actions, response_index) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb', line 40 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 `systemActions` field." \ "Must be present for #{invoked_hook}." ('error', msg) end return if system_actions.nil? unless system_actions.is_a?(Array) ('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
32 33 34 35 36 37 38 |
# File 'lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb', line 32 def system_actions_check(system_actions) system_actions.each do |action| current_error_count = .count { |msg| msg[:type] == 'error' } action_fields_validation(action) valid_system_actions << action if current_error_count == .count { |msg| msg[:type] == 'error' } end end |
#valid_cards ⇒ Object
24 25 26 |
# File 'lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb', line 24 def valid_cards @valid_cards ||= [] end |
#valid_system_actions ⇒ Object
28 29 30 |
# File 'lib/davinci_crd_test_kit/server_tests/service_response_validation_test.rb', line 28 def valid_system_actions @valid_system_actions ||= [] end |