-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
253 | mobile vshe connection #21024
253 | mobile vshe connection #21024
Changes from all commits
e4e5b96
d4d9c09
2436bcb
253afa3
1885067
2cd23b9
17e7df0
5d41c9b
46b6150
3238b5e
eb0b924
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mobile | ||
module V0 | ||
class VetVerificationStatusesController < ApplicationController | ||
def show | ||
response = service.get_vet_verification_status(@current_user.icn) | ||
response['data']['id'] = '' | ||
|
||
render json: response | ||
end | ||
|
||
private | ||
|
||
def service | ||
@service ||= VeteranVerification::Service.new | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type: object | ||
additionalProperties: false | ||
required: | ||
- data | ||
properties: | ||
data: | ||
type: object | ||
additionalProperties: false | ||
required: | ||
- attributes | ||
properties: | ||
attributes: | ||
type: object | ||
additionalProperties: false | ||
required: | ||
- veteranStatus | ||
properties: | ||
veteranStatus: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to include anything about the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ATeal I don't believe there's a way to include optional properties, and |
||
type: string | ||
example: confirmed | ||
notConfirmedReason: | ||
type: string | ||
example: PERSON_NOT_FOUND |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# frozen_string_literal: true | ||
|
||
# require 'rails_helper' | ||
require_relative '../../../support/helpers/rails_helper' | ||
|
||
RSpec.describe 'Mobile::V0::VetVerificationStatuses', type: :request do | ||
let!(:user) { sis_user(icn: '1012667145V762142') } | ||
|
||
before do | ||
sign_in_as(user) | ||
allow_any_instance_of(VeteranVerification::Configuration).to receive(:access_token).and_return('blahblech') | ||
end | ||
|
||
describe '#show' do | ||
context 'when successful' do | ||
it 'returns a status of 200' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/200_show_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
expect(response).to have_http_status(:ok) | ||
end | ||
|
||
it 'returns veteran confirmation status' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/200_show_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
parsed_body = JSON.parse(response.body) | ||
expect(parsed_body['data']['attributes']['veteranStatus']).to eq('confirmed') | ||
end | ||
|
||
it 'removes the Veterans ICN from the response before sending' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/200_show_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
parsed_body = JSON.parse(response.body) | ||
expect(parsed_body['data']['id']).to eq('') | ||
end | ||
end | ||
|
||
context 'when not authorized' do | ||
it 'returns a status of 401' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/401_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
expect(response).to have_http_status(:unauthorized) | ||
end | ||
end | ||
|
||
context 'when ICN not found' do | ||
let(:user) { sis_user(icn: '1012667145V762141') } | ||
|
||
before do | ||
sign_in_as(user) | ||
allow_any_instance_of(VeteranVerification::Configuration).to receive(:access_token).and_return('blahblech') | ||
end | ||
|
||
it 'returns a status of 200' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/200_person_not_found_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
expect(response).to have_http_status(:ok) | ||
end | ||
|
||
it 'returns a person_not_found reason' do | ||
VCR.use_cassette('lighthouse/veteran_verification/status/200_person_not_found_response') do | ||
get '/mobile/v0/vet_verification_status', headers: sis_headers | ||
end | ||
|
||
parsed_body = JSON.parse(response.body) | ||
expect(parsed_body['data']['attributes']['veteranStatus']).to eq('not confirmed') | ||
expect(parsed_body['data']['attributes']['notConfirmedReason']).to eq('PERSON_NOT_FOUND') | ||
expect(parsed_body['data']['message']).to eq(VeteranVerification::Constants::NOT_FOUND_MESSAGE) | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar question as the schema do we need to include anything about the
notConfirmedReason