Skip to content

Commit

Permalink
Make _lastUpdated param for Coverage tests optional, and change searc…
Browse files Browse the repository at this point in the history
…h test so that it does not fail if no _lastUpdated param added or if search for _lastUpdated fails for Coverage resource
  • Loading branch information
emichaud998 committed Oct 25, 2023
1 parent ff8e8b8 commit dddd285
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
12 changes: 11 additions & 1 deletion lib/carin_for_blue_button_test_kit/carin_search_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ def run_search_test(param_value, include_search: false, resource_id: nil)
search_params[search_param_names[0]] = param_value

fhir_search(resource_type, params: search_params)
assert_response_status(200)

# _lastUpdated on Coverage resource is optional and should be skipped if unsuccessful
if search_param_names[0] == '_lastUpdated' && resource_type == 'Coverage'
warning do
assert_response_status(200)
end
skip_if response[:status] != 200, '_lastUpdated search query was unsuccessful and did not respond with a 200 status'
else
assert_response_status(200)
end

assert_resource_type(:bundle)

returned_resources = extract_resources_from_bundle(bundle: resource, response:).select do |item|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class CoverageLastupdatedSearchTest < Inferno::Test
id :c4bb_v200devnonfinancial_coverage__lastUpdated_search_test

input :c4bb_v200devnonfinancial_coverage__lastUpdated_search_test_param,
title: 'Coverage search parameter for _lastUpdated
',
title: 'Coverage search parameter for _lastUpdated',
type: 'text',
description: 'Coverage search parameter: _lastUpdated
'
description: 'Coverage search parameter: _lastUpdated',
optional: true

def self.properties
@properties ||= SearchTestProperties.new(
Expand All @@ -41,6 +40,7 @@ def scratch_resources
end

run do
skip '_lastUpdated optional and not provided' unless c4bb_v200_coverage__lastUpdated_search_test_param.present?
run_search_test(c4bb_v200devnonfinancial_coverage__lastUpdated_search_test_param)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class CoverageLastupdatedSearchTest < Inferno::Test
id :c4bb_v200_coverage__lastUpdated_search_test

input :c4bb_v200_coverage__lastUpdated_search_test_param,
title: 'Coverage search parameter for _lastUpdated
',
title: 'Coverage search parameter for _lastUpdated',
type: 'text',
description: 'Coverage search parameter: _lastUpdated
'
description: 'Coverage search parameter: _lastUpdated',
optional: true

def self.properties
@properties ||= SearchTestProperties.new(
Expand All @@ -41,6 +40,7 @@ def scratch_resources
end

run do
skip '_lastUpdated optional and not provided' unless c4bb_v200_coverage__lastUpdated_search_test_param.present?
run_search_test(c4bb_v200_coverage__lastUpdated_search_test_param)
end
end
Expand Down

0 comments on commit dddd285

Please sign in to comment.