Skip to content

Commit

Permalink
Ensure logging is disabled on facilities retrieval error (#16211)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunTaoLuo authored Apr 4, 2024
1 parent 8796b43 commit af6db1f
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -263,7 +263,9 @@ def merge_clinics(appointments)
def merge_facilities(appointments)
appointments.each do |appt|
appt[:location] = get_facility_memoized(appt[:location_id]) unless appt[:location_id].nil?
if cerner?(appt) && appt[:location]&.values&.any? { |v| v.include?('COL OR 1') }
if cerner?(appt) && appt[:location].is_a?(Hash) && appt[:location]&.values&.any? do |v|
v.include?('COL OR 1')
end
log_appt_id_location_name(appt)
end
end
16 changes: 16 additions & 0 deletions modules/vaos/spec/request/v2/appointments_request_spec.rb
Original file line number Diff line number Diff line change
@@ -338,6 +338,22 @@
end
end

it 'has access and ensures no logging of facility details on mobile facility service fails' do
allow_any_instance_of(VAOS::V2::AppointmentsController).to receive(:get_facility_memoized).and_call_original
VCR.use_cassette('vaos/v2/appointments/get_appointments_200_with_mobile_facility_service_500',
match_requests_on: %i[method path query], allow_playback_repeats: true) do
allow(Rails.logger).to receive(:info)
get '/vaos/v2/appointments?_include=facilities', params:, headers: inflection_header
data = JSON.parse(response.body)['data']
expect(response).to have_http_status(:ok)
expect(response.body).to be_a(String)
expect(data[0]['attributes']['location']).to eq(facility_error_msg)
expect(data[17]['attributes']['location']).not_to eq(facility_error_msg)
expect(Rails.logger).not_to have_received(:info).with("Details for Cerner 'COL OR 1' Appointment", any_args)
expect(response).to match_camelized_response_schema('vaos/v2/appointments', { strict: false })
end
end

it 'has access and returns va appointments given a date range and single status' do
VCR.use_cassette('vaos/v2/appointments/get_appointments_single_status_200',
match_requests_on: %i[method path query]) do

0 comments on commit af6db1f

Please sign in to comment.