Sha256: cc6b295deb400ff78ebed33a512041942e175c3b28a4170c6f9f87cb7fd7b8e6

Contents?: true

Size: 1.49 KB

Versions: 5

Compression:

Stored size: 1.49 KB

Contents

module DaVinciCRDTestKit
  class ClientFHIRApiUpdateTest < Inferno::Test
    id :crd_client_fhir_api_update_test
    title 'Update Interaction'
    description %(
        Verify that the CRD client supports the update interaction for the given resource. The capabilities required by
        each resource can be found here: https://hl7.org/fhir/us/davinci-crd/CapabilityStatement-crd-client.html#resourcesSummary1
      )

    input :update_resources,
          type: 'textarea',
          description:
          'Provide a list of resources to update. e.g., [json_resource_1, json_resource_2]'

    def resource_type
      config.options[:resource_type]
    end

    run do
      assert_valid_json(update_resources)
      update_resources_list = JSON.parse(update_resources)
      skip_if(!update_resources_list.is_a?(Array), 'Resources to update not inputted in list format, skipping test.')

      valid_update_resources =
        update_resources_list
          .compact_blank
          .map { |resource| FHIR.from_contents(resource.to_json) }
          .select { |resource| resource.resourceType == resource_type }
          .select { |resource| resource_is_valid?(resource:) }

      skip_if(valid_update_resources.blank?,
              %(No valid #{resource_type} resources were provided to send in Update requests, skipping test.))

      valid_update_resources.each do |update_resource|
        fhir_update(update_resource, update_resource.id)
        assert_response_status([200, 201])
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
davinci_crd_test_kit-0.11.0 lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb
davinci_crd_test_kit-0.10.0 lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb
davinci_crd_test_kit-0.9.1 lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb
davinci_crd_test_kit-0.9.1.rc lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb
davinci_crd_test_kit-0.9.0 lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb