Skip to content

Commit

Permalink
Update controller specs for removed errors expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 28, 2025
1 parent 37c882f commit 0ae15be
Show file tree
Hide file tree
Showing 40 changed files with 62 additions and 314 deletions.
5 changes: 2 additions & 3 deletions app/forms/webauthn_visit_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ def check_params(params)
return unless error

if @platform_authenticator
errors.add error, translate_platform_authenticator_error(error),
type: :"#{translate_platform_authenticator_error(error).split('.').last}"
errors.add error, :invalid, message: translate_platform_authenticator_error(error)
else
errors.add error, translate_error(error), type: :"#{translate_error(error).split('.').last}"
errors.add error, :invalid, message: translate_error(error)
end
end

Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/account_reset/cancel_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
expect(@analytics).to have_logged_event(
'Account Reset: cancel',
success: false,
errors: { token: [t('errors.account_reset.cancel_token_invalid', app_name: APP_NAME)] },
error_details: {
token: { cancel_token_invalid: true },
},
Expand All @@ -48,7 +47,6 @@
expect(@analytics).to have_logged_event(
'Account Reset: cancel',
success: false,
errors: { token: [t('errors.account_reset.cancel_token_missing', app_name: APP_NAME)] },
error_details: { token: { blank: true } },
user_id: 'anonymous-uuid',
)
Expand Down Expand Up @@ -92,7 +90,6 @@
'Account Reset: cancel token validation',
user_id: 'anonymous-uuid',
success: false,
errors: { token: [t('errors.account_reset.cancel_token_invalid', app_name: APP_NAME)] },
error_details: {
token: { cancel_token_invalid: true },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
let(:invalid_token_message) do
t('errors.account_reset.granted_token_invalid', app_name: APP_NAME)
end
let(:invalid_token_error) { { token: [invalid_token_message] } }

before { stub_analytics }
describe '#delete' do
Expand Down Expand Up @@ -45,7 +44,6 @@
'Account Reset: delete',
user_id: 'anonymous-uuid',
success: false,
errors: invalid_token_error,
error_details: { token: { granted_token_invalid: true } },
mfa_method_counts: {},
identity_verified: false,
Expand All @@ -63,7 +61,6 @@
'Account Reset: delete',
user_id: 'anonymous-uuid',
success: false,
errors: { token: [t('errors.account_reset.granted_token_missing', app_name: APP_NAME)] },
error_details: { token: { blank: true } },
mfa_method_counts: {},
identity_verified: false,
Expand Down Expand Up @@ -91,7 +88,6 @@
'Account Reset: delete',
user_id: user.uuid,
success: false,
errors: { token: [t('errors.account_reset.granted_token_expired', app_name: APP_NAME)] },
error_details: { token: { granted_token_expired: true } },
mfa_method_counts: {},
identity_verified: false,
Expand Down Expand Up @@ -179,7 +175,6 @@
'Account Reset: granted token validation',
user_id: 'anonymous-uuid',
success: false,
errors: invalid_token_error,
error_details: { token: { granted_token_invalid: true } },
)
expect(response).to redirect_to(root_url)
Expand All @@ -199,7 +194,6 @@
'Account Reset: granted token validation',
user_id: user.uuid,
success: false,
errors: { token: [t('errors.account_reset.granted_token_expired', app_name: APP_NAME)] },
error_details: { token: { granted_token_expired: true } },
)
expect(response).to redirect_to(root_url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
expect(@analytics).to have_logged_event(
'Multi-Factor Authentication',
success: false,
errors: { code: ['pattern_mismatch'] },
error_details: { code: { pattern_mismatch: true } },
multi_factor_auth_method: TwoFactorAuthenticatable::AuthMethod::SMS,
enabled_mfa_methods_count: 1,
Expand Down
17 changes: 1 addition & 16 deletions spec/controllers/event_disavowal_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
build_analytics_hash(
user_id: event.user.uuid,
success: false,
errors: { event: [t('event_disavowals.errors.event_already_disavowed')] },
error_details: { event: { event_already_disavowed: true } },
),
)
Expand All @@ -64,7 +63,6 @@
build_analytics_hash(
user_id: event.user.uuid,
success: false,
errors: { event: [t('event_disavowals.errors.event_already_disavowed')] },
error_details: { event: { event_already_disavowed: true } },
),
)
Expand Down Expand Up @@ -102,13 +100,6 @@
build_analytics_hash(
user_id: event.user.uuid,
success: false,
errors: {
password: [
t(
'errors.attributes.password.too_short.other', count: Devise.password_length.first
),
],
},
error_details: { password: { too_short: true } },
),
)
Expand All @@ -127,7 +118,6 @@
build_analytics_hash(
user_id: event.user.uuid,
success: false,
errors: { password: ['Password must be at least 12 characters long'] },
error_details: { password: { too_short: true } },
),
)
Expand All @@ -151,7 +141,6 @@
build_analytics_hash(
user_id: event.user.uuid,
success: false,
errors: { event: [t('event_disavowals.errors.event_already_disavowed')] },
error_details: { event: { event_already_disavowed: true } },
),
)
Expand All @@ -173,9 +162,6 @@
'Event disavowal token invalid',
build_analytics_hash(
success: false,
errors: {
user: [t('event_disavowals.errors.no_account')],
},
error_details: {
user: { blank: true },
},
Expand All @@ -185,12 +171,11 @@
end
end

def build_analytics_hash(success: true, errors: nil, error_details: nil, user_id: nil)
def build_analytics_hash(success: true, error_details: nil, user_id: nil)
{
event_created_at: event.created_at,
disavowed_device_last_used_at: event.device&.last_used_at,
success:,
errors:,
error_details:,
event_id: event.id,
event_type: event.event_type,
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/idv/by_mail/enter_code_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
end

describe '#create' do
let(:otp_code_error_message) { { otp: [t('errors.messages.confirmation_code_incorrect')] } }
let(:success_properties) { { success: true } }

context 'user does not have a pending profile' do
Expand Down Expand Up @@ -382,7 +381,6 @@
expect(@analytics).to have_logged_event(
'IdV: enter verify by mail code submitted',
success: false,
errors: otp_code_error_message,
pending_in_person_enrollment: false,
fraud_check_failed: false,
letter_count: 1,
Expand Down Expand Up @@ -416,7 +414,6 @@
it 'redirects to the rate limited index page to show errors' do
analytics_args = {
success: false,
errors: otp_code_error_message,
pending_in_person_enrollment: false,
fraud_check_failed: false,
letter_count: 1,
Expand Down
2 changes: 0 additions & 2 deletions spec/controllers/idv/how_to_verify_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@
step: 'how_to_verify',
analytics_id: 'Doc Auth',
error_details: { selection: { blank: true } },
errors: { selection: ['Select a way to verify your identity.'] },
success: false,
}
end
Expand All @@ -191,7 +190,6 @@
analytics_id: 'Doc Auth',
selection:,
error_details: { selection: { inclusion: true } },
errors: { selection: ['Select a way to verify your identity.'] },
success: false,
}
end
Expand Down
23 changes: 0 additions & 23 deletions spec/controllers/idv/image_uploads_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: false,
errors: {
front: [I18n.t('doc_auth.errors.not_a_file')],
},
error_details: {
front: { not_a_file: true },
},
Expand Down Expand Up @@ -219,9 +216,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload form submitted',
success: false,
errors: {
limit: [I18n.t('doc_auth.errors.rate_limited_heading')],
},
error_details: {
limit: { rate_limited: true },
},
Expand Down Expand Up @@ -520,9 +514,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: false,
errors: {
name: [I18n.t('doc_auth.errors.alerts.full_name_check')],
},
error_details: {
name: { name: true },
},
Expand Down Expand Up @@ -598,9 +589,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: false,
errors: {
state: [I18n.t('doc_auth.errors.general.no_liveness')],
},
error_details: {
state: { inclusion: true },
},
Expand Down Expand Up @@ -676,9 +664,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: false,
errors: {
state_id_number: [I18n.t('doc_auth.errors.general.no_liveness')],
},
error_details: {
state_id_number: { blank: true },
},
Expand Down Expand Up @@ -750,9 +735,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: false,
errors: {
dob: [I18n.t('doc_auth.errors.alerts.birth_date_checks')],
},
error_details: {
dob: { dob: true },
},
Expand Down Expand Up @@ -825,11 +807,6 @@
expect(@analytics).to have_logged_event(
'IdV: doc auth image upload vendor pii validation',
success: false,
errors: {
state_id_expiration: [
'Try taking new pictures.',
],
},
error_details: {
state_id_expiration: { state_id_expiration: true },
},
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/idv/in_person/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@
flow_path: 'standard',
step: 'ssn',
success: false,
errors: {
ssn: ['Enter a nine-digit Social Security number'],
},
error_details: { ssn: { invalid: true } },
}
end
Expand Down
4 changes: 0 additions & 4 deletions spec/controllers/idv/phone_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@
expect(@analytics).to have_logged_event(
'IdV: phone confirmation form',
success: false,
errors: {
phone: [improbable_phone_message],
otp_delivery_preference: [improbable_otp_message],
},
error_details: {
phone: { improbable_phone: true },
otp_delivery_preference: { inclusion: true },
Expand Down
3 changes: 0 additions & 3 deletions spec/controllers/idv/ssn_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,6 @@
flow_path: 'standard',
step: 'ssn',
success: false,
errors: {
ssn: [t('idv.errors.pattern_mismatch.ssn')],
},
error_details: { ssn: { invalid: true } },
}
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,6 @@
prompt: '',
allow_prompt_login: true,
unauthorized_scope: true,
errors: hash_including(:prompt),
error_details: hash_including(:prompt),
user_fully_authenticated: true,
acr_values: acr_values,
Expand Down Expand Up @@ -2071,7 +2070,6 @@
prompt:,
allow_prompt_login: true,
unauthorized_scope: false,
errors: hash_including(:acr_values),
error_details: hash_including(:acr_values),
user_fully_authenticated: true,
acr_values: '',
Expand Down Expand Up @@ -2237,7 +2235,6 @@
prompt: '',
allow_prompt_login: true,
unauthorized_scope: true,
errors: hash_including(:prompt),
error_details: hash_including(:prompt),
user_fully_authenticated: true,
acr_values: '',
Expand Down Expand Up @@ -2276,7 +2273,6 @@
success: false,
prompt: 'select_account',
unauthorized_scope: true,
errors: hash_including(:client_id),
error_details: hash_including(:client_id),
user_fully_authenticated: true,
acr_values: 'http://idmanagement.gov/ns/assurance/ial/1',
Expand Down Expand Up @@ -2311,7 +2307,6 @@
success: false,
prompt: 'select_account',
unauthorized_scope: true,
errors: hash_including(:client_id),
error_details: hash_including(:client_id),
user_fully_authenticated: true,
acr_values: '',
Expand Down
Loading

0 comments on commit 0ae15be

Please sign in to comment.