Module: AUPSTestKit::BasicTestAttesterIdentifierSlices

Includes:
BasicTestConstants
Included in:
BasicTestAttesterModule
Defined in:
lib/au_ps_inferno/utils/attester/basic_test_attester_identifier_slices.rb

Overview

Must Support identifier slice validation for Composition attester.party reference.

Constant Summary

Constants included from BasicTestConstants

AUPSTestKit::BasicTestConstants::AUTHOR_MS_IDENTIFIER_SLICES_BY_TYPE, AUPSTestKit::BasicTestConstants::NO_SERVER_URL_OMIT_MESSAGE, AUPSTestKit::BasicTestConstants::ORGANIZATION_MS_IDENTIFIER_SLICES, AUPSTestKit::BasicTestConstants::PATIENT_MS_IDENTIFIER_SLICES, AUPSTestKit::BasicTestConstants::PRACTITIONER_MS_IDENTIFIER_SLICES, AUPSTestKit::BasicTestConstants::PRACTITIONER_ROLE_MS_IDENTIFIER_SLICES

Instance Method Summary collapse

Instance Method Details

#test_composition_attester_party_ms_identifier_slicesObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/au_ps_inferno/utils/attester/basic_test_attester_identifier_slices.rb', line 21

def test_composition_attester_party_ms_identifier_slices
  omit_unless_bundle_in_scratch
  resource = attester_party_resource
  skip_if resource.blank?, 'Attester or attester.party is not populated'

  resource_type_str = resource_type(resource)
  slices = AUTHOR_MS_IDENTIFIER_SLICES_BY_TYPE[resource_type_str] || []
  skip_if slices.blank?, 'Referenced attester.party resource type has no Must Support identifier slices'

  rtype_str, profile_str = author_resource_type_and_profiles(resource)
  validate_attester_party_ms_identifier_slices(resource, slices, rtype_str, profile_str)
end

#validate_attester_party_ms_identifier_slices(resource, slices, resource_type_str, profile_str) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/au_ps_inferno/utils/attester/basic_test_attester_identifier_slices.rb', line 10

def validate_attester_party_ms_identifier_slices(resource, slices, resource_type_str, profile_str)
  return unless resource.present? && slices.present?

  identifiers = identifiers_from_resource(resource) || []
  slice_results = attester_party_build_slice_results(slices, identifiers)
  header = attester_party_referenced_type_profile_header(resource_type_str, profile_str)
  lines = slice_results.map { |r| attester_party_format_identifier_slice_line(r) }
  message_type = slice_results.all? { |r| r[:identifier].present? } ? 'info' : 'warning'
  add_message(message_type, attester_party_identifier_slices_full_message(header, lines))
end