class Crucible::Tests::ConnectathonSchedulingTrackTest

Public Class Methods

new(client1, client2=nil) click to toggle source
Calls superclass method Crucible::Tests::BaseTest::new
# File lib/tests/suites/connectathon_scheduling_track.rb, line 13
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_scheduling_track.rb, line 9
def description
  'Connectathon Scheduling Track Test focuses on creating/cancelling Appointments and retreiving Schedules.'
end
id() click to toggle source
# File lib/tests/suites/connectathon_scheduling_track.rb, line 5
def id
  'ConnectathonSchedulingTrackTest'
end
setup() click to toggle source
# File lib/tests/suites/connectathon_scheduling_track.rb, line 19
def setup
  @resources = Crucible::Generator::Resources.new

  # Create a patient
  @patient = @resources.minimal_patient
  @patient.id = nil # clear the identifier, in case the server checks for duplicates
  reply = @client.create(@patient)
  assert_response_ok(reply)
  @patient.id = reply.id

  # Create a practitioner
  @practitioner = @resources.scheduling_practitioner
  @practitioner.id = nil # clear the identifier, in case the server checks for duplicates
  reply = @client.create(@practitioner)
  assert_response_ok(reply)
  @practitioner.id = reply.id

  # Create a schedule
  @schedule = @resources.scheduling_schedule
  @schedule.id = nil # clear the identifier, in case the server checks for duplicates
  @schedule.actor.reference = "Practitioner/#{@practitioner.id}"
  reply = @client.create(@schedule)
  assert_response_ok(reply)
  @schedule.id = reply.id

  # Create a slot
  @slot = @resources.scheduling_slot
  @slot.id = nil # clear the identifier, in case the server checks for duplicates
  @slot.schedule.reference = "Schedule/#{@schedule.id}"
  reply = @client.create(@slot)
  assert_response_ok(reply)
  @slot.id = reply.id
end
teardown() click to toggle source
# File lib/tests/suites/connectathon_scheduling_track.rb, line 53
def teardown
  @client.destroy(FHIR::Patient, @patient.id) if !@patient.id.nil?
  @client.destroy(FHIR::Practitioner, @practitioner.id) if !@practitioner.try(:id).nil?
  @client.destroy(FHIR::Schedule, @schedule.id) if !@schedule.try(:id).nil?
  @client.destroy(FHIR::Slot, @slot.id) if !@slot.try(:id).nil?
  @client.destroy(FHIR::Appointment, @appointment.id) if @appointment && !@appointment.id.nil?
  @client.destroy(FHIR::AppointmentResponse, @appointment_response_patient.id) if @appointment_response_patient && !@appointment_response_patient.id.nil?
  @client.destroy(FHIR::AppointmentResponse, @appointment_response_practitioner.id) if @appointment_response_practitioner && !@appointment_response_practitioner.id.nil?
end