Class: Crucible::Tests::ConnectathonSchedulingTrackTest

Inherits:
BaseSuite show all
Defined in:
lib/tests/suites/connectathon_scheduling_track.rb

Constant Summary

Constants inherited from BaseTest

BaseTest::BASE_SPEC_LINK, BaseTest::JSON_FIELDS, BaseTest::METADATA_FIELDS, BaseTest::REST_SPEC_LINK, BaseTest::STATUS

Instance Attribute Summary

Attributes inherited from BaseTest

#category, #tags, #tests_subset

Instance Method Summary collapse

Methods inherited from BaseSuite

#build_messages, #collect_metadata, #fhir_resources, #links, #metadata, #parse_operation_outcome, #requires, #resource_category, test, #title, #validates

Methods inherited from BaseTest

#author, #details, #execute, #execute_test_method, #execute_test_methods, #multiserver, #requires_authorization, #tests, #warning

Methods included from Assertions

#assert, #assert_bundle_entry_count, #assert_bundle_response, #assert_bundle_transactions_okay, #assert_equal, #assert_etag_present, #assert_last_modified_present, #assert_minimum, #assert_navigation_links, #assert_operator, #assert_resource_content_type, #assert_resource_type, #assert_response_bad, #assert_response_code, #assert_response_created, #assert_response_gone, #assert_response_not_found, #assert_response_ok, #assert_valid_content_location_present, #assert_valid_profile, #assert_valid_resource_content_type_present, #assertion_negated, #skip

Constructor Details

#initialize(client1, client2 = nil) ⇒ ConnectathonSchedulingTrackTest



13
14
15
16
# File 'lib/tests/suites/connectathon_scheduling_track.rb', line 13

def initialize(client1, client2=nil)
  super(client1, client2)
  @category = {id: 'connectathon', title: 'Connectathon'}
end

Instance Method Details

#descriptionObject



9
10
11
# 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

#idObject



5
6
7
# File 'lib/tests/suites/connectathon_scheduling_track.rb', line 5

def id
  'ConnectathonSchedulingTrackTest'
end

#setupObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tests/suites/connectathon_scheduling_track.rb', line 18

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

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

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

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

  # Create a slot
  @slot = @resources.scheduling_slot
  @slot.xmlId = nil # clear the identifier, in case the server checks for duplicates
  @slot.schedule.reference = "Schedule/#{@schedule.xmlId}"
  reply = @client.create(@slot)      
  assert_response_ok(reply)
  @slot.xmlId = reply.id
end

#teardownObject



52
53
54
55
56
57
58
59
60
# File 'lib/tests/suites/connectathon_scheduling_track.rb', line 52

def teardown
  @client.destroy(FHIR::Patient, @patient.xmlId) if !@patient.xmlId.nil?
  @client.destroy(FHIR::Practitioner, @practitioner.xmlId) if !@practitioner.xmlId.nil?
  @client.destroy(FHIR::Schedule, @schedule.xmlId) if !@schedule.xmlId.nil?
  @client.destroy(FHIR::Slot, @slot.xmlId) if !@slot.xmlId.nil?
  @client.destroy(FHIR::Appointment, @appointment.xmlId) if @appointment && !@appointment.xmlId.nil?
  @client.destroy(FHIR::AppointmentResponse, @appointment_response_patient.xmlId) if @appointment_response_patient && !@appointment_response_patient.xmlId.nil?
  @client.destroy(FHIR::AppointmentResponse, @appointment_response_practitioner.xmlId) if @appointment_response_practitioner && !@appointment_response_practitioner.xmlId.nil?
end