Skip to content
Merged
11 changes: 5 additions & 6 deletions lib/idp/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ module Vendors
AAL2 = 2
AAL3 = 3

MOCK_IDV_APPLICANT_FULL_STATE = 'Montana'
MOCK_IDV_APPLICANT_FULL_STATE_ID_JURISDICTION = 'North Dakota'
MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION = 'ND'
MOCK_IDV_APPLICANT_STATE = 'MT'
MOCK_IDV_APPLICANT = {
address1: '1 FAKE RD',
address2: nil,
Expand All @@ -107,7 +110,7 @@ module Vendors
last_name: 'MCFAKERSON',
middle_name: nil,
name_suffix: 'JR',
state: 'MT',
state: MOCK_IDV_APPLICANT_STATE,
state_id_expiration: '2099-12-31',
state_id_issued: '2019-12-31',
state_id_jurisdiction: MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
Expand Down Expand Up @@ -138,6 +141,7 @@ module Vendors

MOCK_IDV_APPLICANT_WITH_SSN = MOCK_IDV_APPLICANT.merge(ssn: '900-66-1234').freeze

MOCK_IDV_APPLICANT_FULL_IDENTITY_DOC_ADDRESS_STATE = 'Virginia'
MOCK_IDV_APPLICANT_STATE_ID_ADDRESS = MOCK_IDV_APPLICANT_WITH_SSN.merge(
identity_doc_address1: '123 Way St',
identity_doc_address2: '2nd Address Line',
Expand Down Expand Up @@ -170,10 +174,5 @@ module Vendors

MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID_WITH_PHONE =
MOCK_IDV_APPLICANT_SAME_ADDRESS_AS_ID.merge(phone: '12025551212').freeze

MOCK_IDV_APPLICANT_FULL_STATE_ID_JURISDICTION = 'North Dakota'
MOCK_IDV_APPLICANT_FULL_STATE = 'Montana'
MOCK_IDV_APPLICANT_FULL_IDENTITY_DOC_ADDRESS_STATE = 'Virginia'
MOCK_IDV_APPLICANT_STATE = 'MT'
end
end
39 changes: 28 additions & 11 deletions spec/controllers/idv/in_person/address_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
include InPersonHelper

let(:user) { build(:user) }
let(:pii_from_user) { Idp::Constants::MOCK_IPP_APPLICANT_SAME_ADDRESS_AS_ID_FALSE }

before do
allow(IdentityConfig.store).to receive(:usps_ipp_transliteration_enabled).
and_return(true)
stub_sign_in(user)
stub_up_to(:hybrid_handoff, idv_session: subject.idv_session)
subject.user_session['idv/in_person'] = {
pii_from_user: Idp::Constants::MOCK_IPP_APPLICANT_SAME_ADDRESS_AS_ID_FALSE.dup,
pii_from_user: pii_from_user,
}
subject.idv_session.ssn = nil
stub_analytics
Expand All @@ -30,20 +31,33 @@
:before,
:set_usps_form_presenter,
)
expect(subject).to have_actions(
:before,
:confirm_in_person_state_id_step_complete,
)
expect(subject).to have_actions(
:before,
:confirm_in_person_address_step_needed,
)
end

context '#confirm_in_person_state_id_step_complete' do
it 'redirects to state id page if not complete' do
before do
subject.user_session['idv/in_person'][:pii_from_user].delete(:identity_doc_address1)
end

it 'redirects to state id page if not complete' do
get :show

expect(response).to redirect_to idv_in_person_state_id_url
end
end

context '#confirm_in_person_address_step_needed' do
before do
request.env['HTTP_REFERER'] = idv_in_person_verify_info_url
end
it 'remains on page when referer is verify info' do
subject.request = idv_in_person_verify_info_url
get :show

expect(response).to render_template :show
Expand All @@ -68,12 +82,15 @@
expect(response).to render_template :show
end

it 'redirects to ssn page when address1 present' do
subject.user_session['idv/in_person'][:pii_from_user][:address1] = '123 Main St'

get :show
context 'when address1 present' do
before do
subject.user_session['idv/in_person'][:pii_from_user][:address1] = '123 Main St'
end
it 'redirects to ssn page' do
get :show

expect(response).to redirect_to idv_in_person_ssn_url
expect(response).to redirect_to idv_in_person_ssn_url
end
end

it 'logs idv_in_person_proofing_address_visited' do
Expand Down Expand Up @@ -101,10 +118,10 @@

describe '#update' do
context 'valid address details' do
let(:address1) { '1 FAKE RD' }
let(:address1) { Idp::Constants::MOCK_IDV_APPLICANT[:address1] }
let(:address2) { 'APT 1B' }
let(:city) { 'GREAT FALLS' }
let(:zipcode) { '59010-4444' }
let(:city) { Idp::Constants::MOCK_IDV_APPLICANT[:city] }
let(:zipcode) { Idp::Constants::MOCK_IDV_APPLICANT[:zipcode] }
let(:state) { 'Montana' }
let(:params) do
{ in_person_address: {
Expand Down
24 changes: 15 additions & 9 deletions spec/controllers/idv/in_person/state_id_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,21 @@
expect(subject.user_session['idv/in_person'][:pii_from_user]).to_not have_key attr
end

make_pii
build_pii_before_state_id_update

# pii includes address attrs on re-visiting state id pg
# since same_address_as_id was initially true, pii includes residential address attrs,
# which are the same as state id address attrs, on re-visiting state id pg
expect(subject.user_session['idv/in_person'][:pii_from_user]).to include(
address1:,
address2:,
city:,
state:,
zipcode:,
identity_doc_address1:,
identity_doc_address2:,
identity_doc_city:,
identity_doc_address_state:,
identity_doc_zipcode:,
Copy link
Copy Markdown
Contributor

@gina-yamada gina-yamada Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test looks like it checks the data before the PUT. What do you think about confirming that the residential address data is included in pii_from_user at this point? (in addition to the state ID address)

address1: identity_doc_address1,
address2: identity_doc_address2,
city: identity_doc_city,
state: identity_doc_address_state,
zipcode: identity_doc_zipcode,
)

# On Verify, user changes response from "Yes,..." to
Expand Down Expand Up @@ -285,7 +291,7 @@
expect(subject.user_session['idv/in_person'][:pii_from_user]).to_not have_key attr
end

make_pii(same_address_as_id: 'false')
build_pii_before_state_id_update(same_address_as_id: 'false')

# On Verify, user changes response from "No,..." to
# "Yes, I live at the address on my state-issued ID
Expand Down Expand Up @@ -322,7 +328,7 @@
end

# User picks "No, I live at a different address" on state ID
make_pii(same_address_as_id: 'false')
build_pii_before_state_id_update(same_address_as_id: 'false')

# On Verify, user does not changes response "No,..."
put :update, params: params
Expand Down
4 changes: 0 additions & 4 deletions spec/factories/in_person_enrollments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,5 @@
trait :enhanced_ipp do
sponsor_id { IdentityConfig.store.usps_eipp_sponsor_id }
end

trait :with_nil_sponsor_id do
sponsor_id { nil }
end
end
end
1 change: 1 addition & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
user: user,
)
create(:in_person_enrollment, :passed, user: user, profile: profile)
profile.in_person_verification_pending_at = nil
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
},
biographical_info: {
birth_year: 1938,
identity_doc_address_state: 'ND',
identity_doc_address_state: 'MT',
state: 'MT',
state_id_jurisdiction: 'ND',
state_id_number: '#############',
Expand Down
6 changes: 4 additions & 2 deletions spec/features/idv/doc_auth/address_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

RSpec.feature 'doc auth verify step', :js do
include IdvStepHelper
include DocAuthHelper

let(:puerto_rico_address1_hint) do
"#{t('forms.example')} 150 Calle A Apt 3"
Expand Down Expand Up @@ -56,7 +55,10 @@
it 'allows the user to enter in a new address' do
expect_step_indicator_current_step(t('step_indicator.flows.idv.verify_info'))
expect(page).not_to have_content(t('forms.example'))
fill_out_address_form_ok
fill_in 'idv_form_address1', with: '123 Main St'
fill_in 'idv_form_city', with: 'Nowhere'
select 'Virginia', from: 'idv_form_state'
fill_in 'idv_form_zipcode', with: '66044'

click_button t('forms.buttons.submit.update')
expect(page).to have_current_path(idv_verify_info_path)
Expand Down
19 changes: 9 additions & 10 deletions spec/features/idv/doc_auth/verify_info_step_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
let(:fake_analytics) { FakeAnalytics.new }
let(:user) { user_with_2fa }

# values from Idp::Constants::MOCK_IDV_APPLICANT
let(:fake_pii_details) do
{
document_state: 'MT',
document_number: '1111111111111',
document_issued: '2019-12-31',
document_expiration: '2099-12-31',
first_name: 'FAKEY',
last_name: 'MCFAKERSON',
date_of_birth: '1938-10-06',
address: '1 FAKE RD',
document_state: MOCK_IDV_APPLICANT[:state],
document_number: MOCK_IDV_APPLICANT[:state_id_number],
document_issued: MOCK_IDV_APPLICANT[:state_id_issued],
document_expiration: MOCK_IDV_APPLICANT[:state_id_expiration],
first_name: MOCK_IDV_APPLICANT[:first_name],
last_name: MOCK_IDV_APPLICANT[:last_name],
date_of_birth: MOCK_IDV_APPLICANT[:dob],
address: MOCK_IDV_APPLICANT[:address1],
}
end

Expand Down Expand Up @@ -247,7 +246,7 @@

context 'AAMVA' do
let(:mock_state_id_jurisdiction) do
[Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction]]
[Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION]
end

context 'when the user lives in an AAMVA supported state' do
Expand Down
8 changes: 5 additions & 3 deletions spec/features/idv/in_person_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS1).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction], count: 3)
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION, count: 1)
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE, count: 2)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)

Expand Down Expand Up @@ -428,12 +429,13 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS1)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY)
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction]).twice
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION).once
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE)
expect(page).to have_text(InPersonHelper::GOOD_ADDRESS1)
expect(page).to have_text(InPersonHelper::GOOD_CITY)
expect(page).to have_text(InPersonHelper::GOOD_ZIPCODE)
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT[:state])
expect(page).to have_text(Idp::Constants::MOCK_IDV_APPLICANT_STATE)
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
complete_verify_step(user)

Expand Down
8 changes: 6 additions & 2 deletions spec/features/idv/in_person_threatmetrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ def deactivate_profile_update_enrollment(status:)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
count: 3,
Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
count: 1,
)
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT_STATE,
count: 2,
)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
Expand Down
4 changes: 2 additions & 2 deletions spec/features/idv/steps/in_person/state_id_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
expect(page).to have_field(t('components.memorable_date.year'), with: '1938')
expect(page).to have_field(
t('in_person_proofing.form.state_id.state_id_jurisdiction'),
with: Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
with: Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
)
expect(page).to have_field(
t('in_person_proofing.form.state_id.state_id_number'),
Expand All @@ -110,7 +110,7 @@
)
expect(page).to have_field(
t('in_person_proofing.form.state_id.identity_doc_address_state'),
with: Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
with: Idp::Constants::MOCK_IDV_APPLICANT_STATE,
)
expect(page).to have_checked_field(
t('in_person_proofing.form.state_id.same_address_as_id_yes'),
Expand Down
8 changes: 6 additions & 2 deletions spec/features/idv/steps/in_person/verify_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
count: 3,
Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
count: 1,
)
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT_STATE,
count: 2,
)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
Expand Down
24 changes: 18 additions & 6 deletions spec/features/idv/steps/in_person_opt_in_ipp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
count: 3,
Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
count: 1,
)
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT_STATE,
count: 2,
)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
Expand Down Expand Up @@ -175,8 +179,12 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
count: 3,
Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
count: 1,
)
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT_STATE,
count: 2,
)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
Expand Down Expand Up @@ -360,8 +368,12 @@
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ADDRESS2).twice
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_CITY).twice
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT[:state_id_jurisdiction],
count: 3,
Idp::Constants::MOCK_IDV_APPLICANT_STATE_ID_JURISDICTION,
count: 1,
)
expect(page).to have_text(
Idp::Constants::MOCK_IDV_APPLICANT_STATE,
count: 2,
)
expect(page).to have_text(InPersonHelper::GOOD_IDENTITY_DOC_ZIPCODE).twice
expect(page).to have_text(DocAuthHelper::GOOD_SSN_MASKED)
Expand Down
1 change: 0 additions & 1 deletion spec/fixtures/artifacts/test-1.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/artifacts/test-2.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/fixtures/artifacts/test-3.txt

This file was deleted.

Loading