Module: BulkDataTestKit::BulkDataExportCancelTests

Extended by:
Forwardable
Included in:
BulkDataTestKit::BulkDataV101::BulkDataExportCancelTest, BulkDataTestKit::BulkDataV200::BulkDataExportCancelTest
Defined in:
lib/bulk_data_test_kit/export_cancel_tests.rb

Instance Method Summary collapse

Instance Method Details

#perform_cancelled_polling_test(bulk_cancelled_polling_url) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/bulk_data_test_kit/export_cancel_tests.rb', line 32

def perform_cancelled_polling_test(bulk_cancelled_polling_url)
  skip 'No polling url available' unless bulk_cancelled_polling_url.present?

  get(bulk_cancelled_polling_url, headers: { authorization: "Bearer #{bearer_token}", accept: 'application/json' })

  assert_response_status(404)

  assert_valid_json(response[:body])
  response_body = JSON.parse(response[:body])

  assert response_body['resourceType'] == 'OperationOutcome', 'Server did not return an OperationOutcome'
  assert_valid_resource(resource: FHIR::OperationOutcome.new(response_body))
end

#perform_export_cancel_testObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bulk_data_test_kit/export_cancel_tests.rb', line 15

def perform_export_cancel_test
  use_token = !bearer_token.blank?
  url = bulk_export_url.dup
  if resource_type == 'Group'
    skip_if group_id.blank?, 'Group id is blank, skipping test.'
    url = bulk_export_url.gsub('[group_id]', group_id) if resource_type == 'Group'
  end

  perform_export_kick_off_request(use_token:, url:)
  assert_response_status(202)
  begin
    request.response_header('content-location')&.value
  ensure
    delete_export_kick_off_request
  end
end