Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 10, 2024
2 parents 323c04f + 7b7ffaf commit 6a29db9
Show file tree
Hide file tree
Showing 78 changed files with 16,491 additions and 412 deletions.
5 changes: 1 addition & 4 deletions config/settings/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ bgs:
client_station_id: 281
client_username: VAgovAPI
url: https://internal-dsva-vagov-dev-fwdproxy-1893365470.us-gov-west-1.elb.amazonaws.com:4447
# Put this in `config/settings/test.local.yml` and then erb-template in
# `Settings.bgs.url` to cassettes that are run with the VCR option `erb: true`.
# `BGSClientHelpers#use_bgs_cassette` provides erb-templating enabled cassettes
# and supplies a template local `bgs_base_url`.
# You can use this in `config/settings/test.local.yml`.
# bgs:
# url: https://localhost:4447
# ssl_verify_mode: "none"
Expand Down
1 change: 1 addition & 0 deletions modules/claims_api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ssh -L 4431:localhost:4431 {{aws-url}}

## Testing
### Unit testing BGS service operation wrappers
If using cassettes, make sure to only make or use ones under [spec/support/vcr_cassettes/claims_api](spec/support/vcr_cassettes/claims_api)
Check out documentation in comments for the spec helper `BGSClientHelpers#use_bgs_cassette`

## OpenApi/Swagger Doc Generation
Expand Down
2 changes: 1 addition & 1 deletion modules/claims_api/spec/lib/claims_api/bd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let(:pdf_path) { 'modules/claims_api/spec/fixtures/21-526EZ.pdf' }

it 'uploads a document to BD' do
VCR.use_cassette('bd/upload') do
VCR.use_cassette('claims_api/bd/upload') do
result = subject.upload(claim:, pdf_path:)
expect(result).to be_a Hash
expect(result[:data][:success]).to be true
Expand Down
7 changes: 4 additions & 3 deletions modules/claims_api/spec/lib/claims_api/local_bgs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

describe '#find_poa_by_participant_id' do
it 'responds as expected, with extra ClaimsApi::Logger logging' do
VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id') do
VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do
allow_any_instance_of(BGS::OrgWebService).to receive(:find_poa_history_by_ptcpnt_id).and_return({})

# Events logged:
Expand Down Expand Up @@ -42,7 +42,8 @@
end

it 'triggers StatsD measurements' do
VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id', allow_playback_repeats: true) do
VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id',
allow_playback_repeats: true) do
allow_any_instance_of(BGS::OrgWebService).to receive(:find_poa_history_by_ptcpnt_id).and_return({})

%w[establish_ssl_connection connection_wsdl_get connection_post parsed_response].each do |event|
Expand Down Expand Up @@ -72,7 +73,7 @@

context 'when claims come back as a hash instead of an array' do
it 'casts the hash as an array' do
VCR.use_cassette('bgs/claims/claims_trimmed_down') do
VCR.use_cassette('claims_api/bgs/claims/claims_trimmed_down') do
claims = subject_instance.find_benefit_claims_status_by_ptcpnt_id('600061742')
claims[:benefit_claims_dto][:benefit_claim] = claims[:benefit_claims_dto][:benefit_claim][0]
allow(subject_instance).to receive(:find_benefit_claims_status_by_ptcpnt_id).with(id).and_return(claims)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
options[:jrn_obj_id] = 'VAgovAPI'
options[:jrn_status_type_cd] = 'U'
options[:jrn_user_id] = 'VAgovAPI'
VCR.use_cassette('bgs/vnp_proc_form_service/vnp_proc_form_create') do
VCR.use_cassette('claims_api/bgs/vnp_proc_form_service/vnp_proc_form_create') do
response = subject.vnp_proc_form_create(options)
expect(response[:comp_id][:vnp_proc_id]).to eq '3831394'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

describe 'vnp_proc_create' do
it 'responds with a vnp_proc_id' do
VCR.use_cassette('bgs/vnp_proc_service_v2/vnp_proc_create') do
VCR.use_cassette('claims_api/bgs/vnp_proc_service_v2/vnp_proc_create') do
result = subject.vnp_proc_create
expect(result[:vnp_proc_id]).to eq '29637'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
options[:vnp_ptcpnt_id] = '44693'
options[:phone_nbr] = '2225552252'
options[:efctv_dt] = '2020-07-16T18:20:17Z'
VCR.use_cassette('bgs/vnp_ptcpnt_phone_service/vnp_ptcpnt_phone_create') do
VCR.use_cassette('claims_api/bgs/vnp_ptcpnt_phone_service/vnp_ptcpnt_phone_create') do
response = subject.vnp_ptcpnt_phone_create(options)
expect(response[:vnp_proc_id]).to eq '29798'
expect(response[:vnp_ptcpnt_id]).to eq '44693'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
options[:tin_waiver_reason_type_cd] = nil
options[:ptcpnt_fk_ptcpnt_id] = nil
options[:corp_ptcpnt_id] = nil
VCR.use_cassette('bgs/vnp_ptcpnt_service/vnp_ptcpnt_create') do
VCR.use_cassette('claims_api/bgs/vnp_ptcpnt_service/vnp_ptcpnt_create') do
response = subject.vnp_ptcpnt_create(options)
expect(response).to include(
{ vnp_ptcpnt_id: '181913',
Expand Down
8 changes: 4 additions & 4 deletions modules/claims_api/spec/models/veteran/service/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
let(:ows) { ClaimsApi::LocalBGS }

it 'initializes from a user' do
VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id') do
VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do
allow_any_instance_of(ows).to receive(:find_poa_history_by_ptcpnt_id)
.and_return({ person_poa_history: { person_poa: [{ begin_dt: Time.zone.now, legacy_poa_cd: '033' }] } })
veteran = Veteran::User.new(user)
Expand All @@ -28,7 +28,7 @@
end

it 'does not bomb out if poa is missing' do
VCR.use_cassette('bgs/claimant_web_service/not_find_poa_by_participant_id') do
VCR.use_cassette('claims_api/bgs/claimant_web_service/not_find_poa_by_participant_id') do
allow_any_instance_of(ows).to receive(:find_poa_history_by_ptcpnt_id)
.and_return({ person_poa_history: nil })
veteran = Veteran::User.new(user)
Expand All @@ -38,7 +38,7 @@
end

it 'provides most recent previous poa' do
VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id') do
VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do
allow_any_instance_of(ows).to receive(:find_poa_history_by_ptcpnt_id)
.and_return({
person_poa_history: {
Expand All @@ -55,7 +55,7 @@
end

it 'does not bomb out if poa history contains a single record' do
VCR.use_cassette('bgs/claimant_web_service/find_poa_by_participant_id') do
VCR.use_cassette('claims_api/bgs/claimant_web_service/find_poa_by_participant_id') do
allow_any_instance_of(ows).to receive(:find_poa_history_by_ptcpnt_id)
.and_return({ person_poa_history: { person_poa: { begin_dt: Time.zone.now, legacy_poa_cd: '033' } } })
veteran = Veteran::User.new(user)
Expand Down
38 changes: 19 additions & 19 deletions modules/claims_api/spec/requests/v1/claims_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
context 'index' do
it 'lists all Claims', run_at: 'Tue, 12 Dec 2017 03:09:06 GMT' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claims') do
VCR.use_cassette('claims_api/bgs/claims/claims') do
allow_any_instance_of(ClaimsApi::V1::ApplicationController)
.to receive(:target_veteran).and_return(target_veteran)
get '/services/claims/v1/claims', params: nil, headers: request_headers.merge(auth_header)
Expand All @@ -59,7 +59,7 @@

it 'lists all Claims when camel-inflection', run_at: 'Tue, 12 Dec 2017 03:09:06 GMT' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claims') do
VCR.use_cassette('claims_api/bgs/claims/claims') do
allow_any_instance_of(ClaimsApi::V1::ApplicationController)
.to receive(:target_veteran).and_return(target_veteran)
get '/services/claims/v1/claims', params: nil, headers: request_headers_camel.merge(auth_header)
Expand All @@ -71,7 +71,7 @@
context 'with errors' do
it 'shows a errored Claims not found error message' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claims_with_errors') do
VCR.use_cassette('claims_api/bgs/claims/claims_with_errors') do
get '/services/claims/v1/claims', params: nil, headers: request_headers.merge(auth_header)
expect(response.status).to eq(404)
end
Expand All @@ -83,7 +83,7 @@
context 'for a single claim' do
it 'shows a single Claim', run_at: 'Wed, 13 Dec 2017 03:28:23 GMT' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get "/services/claims/v1/claims/#{bgs_claim_id}", params: nil, headers: request_headers.merge(auth_header)
expect(response).to match_response_schema('claims_api/claim')
end
Expand All @@ -92,7 +92,7 @@

it 'shows a single Claim when camel-inflected', run_at: 'Wed, 13 Dec 2017 03:28:23 GMT' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get "/services/claims/v1/claims/#{bgs_claim_id}", params: nil,
headers: request_headers_camel.merge(auth_header)
expect(response).to match_camelized_response_schema('claims_api/claim')
Expand All @@ -109,7 +109,7 @@
auth_headers: { some: 'data' },
evss_id: 600_118_851,
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9')
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get(
"/services/claims/v1/claims/#{bgs_claim_id}",
params: nil, headers: request_headers.merge(auth_header)
Expand All @@ -128,7 +128,7 @@
auth_headers: { some: 'data' },
evss_id: 600_118_851,
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9')
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get(
"/services/claims/v1/claims/#{bgs_claim_id}",
params: nil, headers: request_headers_camel.merge(auth_header)
Expand All @@ -148,7 +148,7 @@
auth_headers: { some: 'data' },
evss_id: 600_118_851,
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9')
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get(
'/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9',
params: nil, headers: request_headers.merge(auth_header)
Expand All @@ -171,7 +171,7 @@
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9')
expect_any_instance_of(claims_service).to receive(:update_from_remote)
.and_raise(StandardError.new('no claim found'))
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get(
"/services/claims/v1/claims/#{bgs_claim_id}",
params: nil, headers: request_headers.merge(auth_header)
Expand All @@ -185,7 +185,7 @@
context 'with errors' do
it '404s' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim_with_errors') do
VCR.use_cassette('claims_api/bgs/claims/claim_with_errors') do
get '/services/claims/v1/claims/123123131', params: nil, headers: request_headers.merge(auth_header)
expect(response.status).to eq(404)
end
Expand All @@ -194,7 +194,7 @@

it 'missing MPI Record' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim_with_errors') do
VCR.use_cassette('claims_api/bgs/claims/claim_with_errors') do
vet = ClaimsApi::Veteran.new(
uuid: request_headers['X-VA-SSN']&.gsub(/[^0-9]/, ''),
ssn: request_headers['X-VA-SSN']&.gsub(/[^0-9]/, ''),
Expand Down Expand Up @@ -223,7 +223,7 @@

it 'missing an ICN' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim_with_errors') do
VCR.use_cassette('claims_api/bgs/claims/claim_with_errors') do
vet = ClaimsApi::Veteran.new(
uuid: request_headers['X-VA-SSN']&.gsub(/[^0-9]/, ''),
ssn: request_headers['X-VA-SSN']&.gsub(/[^0-9]/, ''),
Expand Down Expand Up @@ -256,7 +256,7 @@
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9',
status: 'errored',
evss_response: [{ 'key' => 'Error', 'severity' => 'FATAL', 'text' => 'Failed' }])
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
headers = request_headers.merge(auth_header)
get('/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9', params: nil, headers:)
expect(response.status).to eq(422)
Expand All @@ -273,7 +273,7 @@
id: 'd5536c5c-0465-4038-a368-1a9d9daf65c9',
status: 'errored',
evss_response: nil)
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
headers = request_headers.merge(auth_header)
get('/services/claims/v1/claims/d5536c5c-0465-4038-a368-1a9d9daf65c9', params: nil, headers:)
expect(response.status).to eq(422)
Expand All @@ -286,7 +286,7 @@
context 'POA verifier' do
it 'users the poa verifier when the header is present' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
Expand All @@ -304,7 +304,7 @@
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
VCR.use_cassette('bgs/claims/claims') do
VCR.use_cassette('claims_api/bgs/claims/claims') do
allow_any_instance_of(ClaimsApi::V1::ApplicationController)
.to receive(:target_veteran).and_return(target_veteran)
get '/services/claims/v1/claims', params: nil, headers: auth_header
Expand All @@ -318,7 +318,7 @@
verifier_stub = instance_double('BGS::PowerOfAttorneyVerifier')
allow(BGS::PowerOfAttorneyVerifier).to receive(:new) { verifier_stub }
allow(verifier_stub).to receive(:verify)
VCR.use_cassette('bgs/claims/claims') do
VCR.use_cassette('claims_api/bgs/claims/claims') do
get '/services/claims/v1/claims', params: nil, headers: auth_header.merge(camel_inflection_header)
expect(response).to match_camelized_response_schema('claims_api/claims')
end
Expand All @@ -329,7 +329,7 @@
context "when a 'Token Validation Error' is received" do
it "raises a 'Common::Exceptions::Unauthorized' exception", run_at: 'Tue, 12 Dec 2017 03:09:06 GMT' do
auth = { Authorization: 'Bearer The-quick-brown-fox-jumped-over-the-lazy-dog' }
VCR.use_cassette('bgs/claims/claims') do
VCR.use_cassette('claims_api/bgs/claims/claims') do
get '/services/claims/v1/claims', params: nil,
headers: request_headers.merge(auth)
parsed_response = JSON.parse(response.body)
Expand All @@ -343,7 +343,7 @@
context 'events timeline' do
it 'maps BGS data to match previous logic with EVSS data' do
mock_acg(scopes) do |auth_header|
VCR.use_cassette('bgs/claims/claim') do
VCR.use_cassette('claims_api/bgs/claims/claim') do
get "/services/claims/v1/claims/#{bgs_claim_id}", params: nil, headers: request_headers.merge(auth_header)
body = JSON.parse(response.body)
events_timeline = body['data']['attributes']['events_timeline']
Expand Down
Loading

0 comments on commit 6a29db9

Please sign in to comment.