Module: BulkDataTestKit::BulkDataExportParametersTests

Extended by:
Forwardable
Included in:
BulkDataTestKit::BulkDataV200::BulkDataOutputFormatParamTest, BulkDataTestKit::BulkDataV200::BulkDataSinceParamTest
Defined in:
lib/bulk_data_test_kit/export_parameters_tests.rb

Instance Method Summary collapse

Instance Method Details

#perform_outputFormat_param_testObject



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

def perform_outputFormat_param_test
  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

  ['application/fhir+ndjson', 'application/ndjson', 'ndjson'].each do |format|
    kickoff_url = url.dup
    perform_export_kick_off_request(params: { _outputFormat: format }, url: kickoff_url)
    assert_response_status(202)

    delete_export_kick_off_request
  end
end

#perform_since_param_test(since_timestamp_param) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/bulk_data_test_kit/export_parameters_tests.rb', line 31

def perform_since_param_test(since_timestamp_param)
  fhir_instant_regex = /
    ([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)
    -(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])
    T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)
    ?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))
  /x

  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

  assert since_timestamp_param.match?(fhir_instant_regex),
         "The provided `_since` timestamp `#{since_timestamp_param}` is not a valid " \
         '[FHIR instant](https://www.hl7.org/fhir/datatypes.html#instant).'

  perform_export_kick_off_request(params: { _since: since_timestamp_param }, url:)
  assert_response_status(202)

  delete_export_kick_off_request
end