-
Notifications
You must be signed in to change notification settings - Fork 166
LG-8645 β Rename GetUspsProofingResultsJob method and improve tests #8365
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
Changes from all commits
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 |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| require 'rails_helper' | ||
|
|
||
| RSpec.shared_examples 'enrollment_with_a_status_update' do |passed:, status:, response_json:| | ||
| RSpec.shared_examples 'enrollment_with_a_status_update' do |passed:, | ||
| email_type:, | ||
| enrollment_status:, | ||
|
Comment on lines
+4
to
+5
Contributor
Author
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. I added |
||
| response_json:| | ||
|
|
||
| it 'logs a message with common attributes' do | ||
| freeze_time do | ||
| pending_enrollment.update( | ||
|
|
@@ -43,17 +47,22 @@ | |
| end | ||
| end | ||
|
|
||
| context 'email_analytics_attributes' do | ||
| before(:each) do | ||
| stub_request_passed_proofing_results | ||
| end | ||
|
Comment on lines
-47
to
-49
Contributor
Author
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. this stub was causing only 'passed' emails to be sent, no matter what the test calling this shared example had configured |
||
|
|
||
| it 'logs message with email analytics attributes' do | ||
| freeze_time do | ||
| job.perform(Time.zone.now) | ||
| it 'logs message with email analytics attributes' do | ||
| freeze_time do | ||
| job.perform(Time.zone.now) | ||
| if email_type == 'deadline passed' | ||
| expect(job_analytics).to have_logged_event( | ||
| 'GetUspsProofingResultsJob: deadline passed email initiated', | ||
|
Contributor
Author
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. expired enrollments trigger sending of a completely different type of email; now that we're no longer always sending 'passed' emails, we can test specifically for them |
||
| enrollment_code: pending_enrollment.enrollment_code, | ||
| enrollment_id: pending_enrollment.id, | ||
| wait_until: anything, | ||
| service_provider: pending_enrollment.issuer, | ||
| timestamp: Time.zone.now, | ||
| ) | ||
| else | ||
| expect(job_analytics).to have_logged_event( | ||
| 'GetUspsProofingResultsJob: Success or failure email initiated', | ||
| email_type: anything, | ||
| email_type: email_type, | ||
|
Comment on lines
-56
to
+65
Contributor
Author
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. now that we're no longer always sending 'passed' emails, we can expect a specific |
||
| enrollment_code: pending_enrollment.enrollment_code, | ||
| wait_until: anything, | ||
| service_provider: pending_enrollment.issuer, | ||
|
|
@@ -75,7 +84,7 @@ | |
| expect(pending_enrollment.status_updated_at).to eq(Time.zone.now) | ||
| expect(pending_enrollment.status_check_attempted_at).to eq(Time.zone.now) | ||
| expect(pending_enrollment.status_check_completed_at).to eq(Time.zone.now) | ||
| expect(pending_enrollment.status).to eq(status) | ||
| expect(pending_enrollment.status).to eq(enrollment_status) | ||
| expect(pending_enrollment.profile.active).to eq(passed) | ||
| end | ||
| end | ||
|
|
@@ -608,7 +617,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: true, | ||
| status: 'passed', | ||
| email_type: 'Success', | ||
| enrollment_status: 'passed', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_passed_proofing_results_response, | ||
| ) | ||
|
|
@@ -643,7 +653,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'failed', | ||
| email_type: 'Failed', | ||
| enrollment_status: 'failed', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_failed_proofing_results_response, | ||
| ) | ||
|
|
@@ -678,7 +689,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'failed', | ||
| email_type: 'Failed fraud suspected', | ||
| enrollment_status: 'failed', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_failed_suspected_fraud_proofing_results_response, | ||
| ) | ||
|
|
@@ -714,7 +726,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'failed', | ||
| email_type: 'Failed unsupported ID type', | ||
| enrollment_status: 'failed', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_passed_proofing_unsupported_id_results_response, | ||
| ) | ||
|
|
@@ -750,7 +763,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'expired', | ||
| email_type: 'deadline passed', | ||
| enrollment_status: 'expired', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_expired_proofing_results_response, | ||
| ) | ||
|
|
@@ -778,7 +792,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'expired', | ||
| email_type: 'deadline passed', | ||
| enrollment_status: 'expired', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_unexpected_expired_proofing_results_response, | ||
| ) | ||
|
|
@@ -1048,7 +1063,8 @@ | |
| it_behaves_like( | ||
| 'enrollment_with_a_status_update', | ||
| passed: false, | ||
| status: 'failed', | ||
| email_type: 'Failed unsupported secondary ID', | ||
| enrollment_status: 'failed', | ||
| response_json: UspsInPersonProofing::Mock::Fixtures. | ||
| request_passed_proofing_secondary_id_type_results_response, | ||
| ) | ||
|
|
@@ -1064,15 +1080,6 @@ | |
| reason: 'Provided secondary proof of address', | ||
| ), | ||
| ) | ||
|
|
||
| expect(job_analytics).to have_logged_event( | ||
| 'GetUspsProofingResultsJob: Success or failure email initiated', | ||
| email_type: 'Failed', | ||
| enrollment_code: pending_enrollment.enrollment_code, | ||
| service_provider: anything, | ||
| timestamp: anything, | ||
| wait_until: nil, | ||
| ) | ||
|
Comment on lines
-1068
to
-1075
Contributor
Author
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. this expectation was redundant with the |
||
| 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.
my one thought with this is that there isn't really a separate version of the failed email for unsupported ids. We have a standard failure email (which is the one we're sending in this case) and a failure b/c of suspected fraud.
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.
yeah, I was hesitant at first, but noticed that we log
'Failed unsupported ID type'inhandle_unsupported_id_typeabove, and think this message would be useful for filtering when searching logs.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.
ok that makes sense to me then
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.
Since this event is established, it'd be good to first confirm there has been a discussion w/ product to check if they currently have dashboards or reports that would need to be adjusted for the updated value.