class Crucible::Tests::ConnectathonAttachmentTrackTest

Attributes

attachments[RW]

Public Class Methods

new(client1, client2=nil) click to toggle source
Calls superclass method Crucible::Tests::BaseTest::new
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 16
def initialize(client1, client2=nil)
  super(client1, client2)
  @tags.append('connectathon')
  @category = {id: 'connectathon', title: 'Connectathon'}
end

Public Instance Methods

description() click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 12
def description
  'Test support for using FHIR-based messaging for exchanging attachments, particularly for claims processing/payer provider interactions.'
end
id() click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 8
def id
  'ConnectathonAttachmentTrackTest'
end
setup() click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 22
def setup
  @attachments = {}
  @mime_types = {}
  @records = {}
  @attachments["pdf"] = 'ccda_pdf.pdf'
  @attachments["structured"] = 'ccda_structured.xml'
  @attachments["unstructured"] = 'ccda_unstructured.xml'

  @mime_types["pdf"] = "application/pdf"
  @mime_types["structured"] = "application/xml"
  @mime_types["unstructured"] = "application/xml"

  @resources = Crucible::Generator::Resources.new

  patient = @resources.load_fixture("patient/patient-register-create.xml")
  practitioner = @resources.load_fixture("practitioner/practitioner-register-create.xml")


  create_object(patient, :patient)
  create_object(practitioner, :practitioner)
end
teardown() click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 44
def teardown
  @records.each_value do |value|
    @client.destroy(value.class, value.id)
  end
end

Private Instance Methods

base64_encoded(type) click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 106
def base64_encoded(type)
  Base64.encode64(File.read(File.join(Crucible::Generator::Resources::FIXTURE_DIR, "attachment", "#{@attachments[type]}")))
end
create_object(obj, obj_sym) click to toggle source
# File lib/tests/suites/connectathon_attachment_track_test.rb, line 110
def create_object(obj, obj_sym)
  reply = @client.create obj
  assert_response_ok(reply)
  obj.id = reply.id
  @records[obj_sym] = obj

  warning { assert_valid_resource_content_type_present(reply) }
  warning { assert_valid_content_location_present(reply) }

  warning { assert @records[obj_sym].equals? reply.resource }
end