-
Notifications
You must be signed in to change notification settings - Fork 19
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
Konstantin/appeals 64667 #23588
Draft
KonstantinShevtsov
wants to merge
21
commits into
feature/APREQ-97
Choose a base branch
from
Konstantin/APPEALS-64667
base: feature/APREQ-97
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Konstantin/appeals 64667 #23588
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4caa8f4
adds sc nonrating ramanded, removes unused logical converter and comm…
KonstantinShevtsov 14baa8b
2 more scenarios added
KonstantinShevtsov b6a8628
closed_at and closed_status checks added
KonstantinShevtsov 80c556a
scenario_sc_unidentified_issue_and_ineligible_legacy_issue added
KonstantinShevtsov 14ff58c
scenario file renamed
KonstantinShevtsov e92e8db
adds 4 more scenarios, updates previously created
KonstantinShevtsov ba21d52
2 more scenarios added
KonstantinShevtsov c0cb1ea
scenario_sc_prior_cf_decision_nonrating_issue_and_rating_decision_spe…
KonstantinShevtsov b5fa47b
sc_prior_cf_decision_rating_issue_and_ineligible_legacy_issue_not_wit…
KonstantinShevtsov e82d851
hlr_with_same_office_and_informal_conference_and_development_item_id …
KonstantinShevtsov e9e508a
scenario_sc_with_limited_poa_access_spec.rb added
KonstantinShevtsov 30fccad
epe poa attributes checks added, scenario_sc_without_limited_poa_acce…
KonstantinShevtsov b34b527
adds api disbled tests, removes commented lines
KonstantinShevtsov d647a84
adds handling of duplicate events tests
KonstantinShevtsov f0ff37a
completed scenario added
KonstantinShevtsov 30c363b
all scenarios updated
KonstantinShevtsov 930a10d
adds invalid payload case to completed event test scenario
KonstantinShevtsov f924604
create scenarios updated
KonstantinShevtsov 7ab322e
scenario_hlr_nonrating_closed_spec.rb updated toogle disable added
KonstantinShevtsov 7731aaf
Update scenario_hlr_nonrating_closed_spec.rb
KonstantinShevtsov d420135
Update scenario_hlr_nonrating_closed_spec.rb
KonstantinShevtsov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
211 changes: 211 additions & 0 deletions
211
spec/feature/events/decision_review_completed/scenario_hlr_nonrating_closed_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe Api::Events::V1::DecisionReviewCompletedController, type: :controller do | ||
describe "POST #decision_review_completed" do | ||
let!(:current_user) { User.authenticate! } | ||
let(:api_key) { ApiKey.create!(consumer_name: "API TEST TOKEN") } | ||
let!(:epe) { create(:end_product_establishment, :active_hlr, reference_id: 20_010_065) } | ||
|
||
def json_test_payload | ||
{ | ||
"css_id": "BVADWISE", | ||
"detail_type": "HigherLevelReview", | ||
"station": "101", | ||
"claim_id": 20_010_065, | ||
"event_id": 1_234_567, | ||
"end_product_establishment": { | ||
"synced_status": "CLR", | ||
"last_synced_at": 1_702_067_145_000, | ||
"code": "030HLRR", | ||
"development_item_reference_id": null, | ||
"reference_id": "20010065" | ||
}, | ||
"claim_review": { | ||
"auto_remand": null, | ||
"remand_source_id": null, | ||
"informal_conference": null, | ||
"same_office": null, | ||
"legacy_opt_in_approved": false | ||
}, | ||
"completed_issues": [ | ||
"id": 12, | ||
"benefit_type": "compensation", | ||
"closed_at": 1_702_067_145_000, | ||
"closed_status": "closed", | ||
"contention_reference_id": 7_905_752, | ||
"contested_issue_description": null, | ||
"contested_rating_issue_diagnostic_code": null, | ||
"contested_rating_issue_reference_id": null, | ||
"contested_rating_issue_profile_date": null, | ||
"contested_decision_issue_id": 12_345, | ||
"decision_date": 18_475, | ||
"decision_review_issue_id": 1_234, | ||
"is_unidentified": null, | ||
"unidentified_issue_text": "unidentified text", | ||
"nonrating_issue_bgs_id": "13", | ||
"nonrating_issue_bgs_source": "CORP_AWARD_ATTORNEY_FEE", | ||
"nonrating_issue_category": "Accrued Benefits", | ||
"nonrating_issue_description": "The user entered description if the issue is a nonrating issue", | ||
"original_caseflow_request_issue_id": 12_345, | ||
"ramp_claim_id": null, | ||
"rating_issue_associated_at": null, | ||
"type": "RequestIssue", | ||
"untimely_exemption": null, | ||
"untimely_exemption_notes": null, | ||
"vacols_id": null, | ||
"vacols_sequence_id": null, | ||
"veteran_participant_id": "210002659", | ||
"decision_issue": { | ||
"benefit_type": "compensation", | ||
"decision_text": "service connected", | ||
"description": null, | ||
"diagnostic_code": null, | ||
"disposition": "Granted", | ||
"end_product_last_action_date": 19_594, | ||
"participant_id": "1826209", | ||
"percent_number": "50", | ||
"rating_issue_reference_id": null, | ||
"rating_profile_date": null, | ||
"rating_promulgation_date": null, | ||
"subject_text": "This broadcast may not be reproduced" | ||
} | ||
] | ||
} | ||
end | ||
|
||
let!(:valid_params) do | ||
json_test_payload | ||
end | ||
|
||
let!(:invalid_params) do | ||
{ | ||
"css_id": null, | ||
"detail_type": "BLA", | ||
"station": "SPACE", | ||
"event_id": null, | ||
"end_product_establishment": { | ||
"synced_status": "Something", | ||
"last_synced_at": null, | ||
"code": "ERROR", | ||
"development_item_reference_id": null, | ||
"reference_id": "20010065" | ||
}, | ||
"claim_review": {}, | ||
"completed_issues": [ | ||
"id": null, | ||
"decision_issue": {} | ||
] | ||
} | ||
end | ||
|
||
context "updates issue scenario_hlr_1_eligible_nonrating_issue" do | ||
before do | ||
FeatureToggle.disable!(:disable_ama_eventing) | ||
request.headers["Authorization"] = "Token token=#{api_key.key_string}" | ||
end | ||
|
||
it "returns success response scenario_hlr_1_eligible_nonrating_issue" do | ||
post :decision_review_completed, params: valid_params | ||
expect(response).to have_http_status(:completed) | ||
expect(response.body).to include("DecisionReviewCompletedEvent successfully processed") | ||
completed_request_issue = RequestIssue.find_by(reference_id: "1234") | ||
expect(completed_request_issue).to be | ||
expect(completed_request_issue.nonrating_issue_category).to eq("Accrued Benefits") | ||
expect(completed_request_issue.nonrating_issue_description) | ||
.to eq("The user entered description if the issue is a nonrating issue") | ||
expect(completed_request_issue.nonrating_issue_bgs_source).to eq("CORP_AWARD_ATTORNEY_FEE") | ||
expect(completed_request_issue.nonrating_issue_bgs_id).to eq("13") | ||
expect(completed_request_issue.rating_issue_associated_at).to eq(nil) | ||
expect(completed_request_issue.closed_at).to eq(1_702_067_145_000) | ||
expect(completed_request_issue.closed_status).to eq("closed") | ||
expect(completed_request_issue.contested_issue_description).to eq(nil) | ||
expect(completed_request_issue.contention_reference_id).to eq(7_905_752) | ||
# expect(completed_request_issue.contested_rating_decision_reference_id).to eq(nil) | ||
expect(completed_request_issue.contested_rating_issue_profile_date).to eq(nil) | ||
expect(completed_request_issue.contested_rating_issue_reference_id).to eq(nil) | ||
expect(completed_request_issue.vacols_id).to eq(nil) | ||
expect(completed_request_issue.vacols_sequence_id).to eq(nil) | ||
# decision_issue = DecisionIssue.joins(:request_issues).find_by(request_issues: { reference_id: "1234" }) | ||
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. Address this comment before merging |
||
decision_issue = completed_request_issue.decision_issues.last | ||
expect(decision_issue.benefit_type).to eq("compensation") | ||
expect(decision_issue.decision_text).to eq("service connected") | ||
expect(decision_issue.description).to eq(nil) | ||
expect(decision_issue.diagnostic_code).to eq(nil) | ||
expect(decision_issue.disposition).to eq("Granted") | ||
expect(decision_issue.end_product_last_action_date).to eq(19_594) | ||
expect(decision_issue.participant_id).to eq("1826209") | ||
expect(decision_issue.percent_number).to eq("50") | ||
expect(decision_issue.rating_issue_reference_id).to eq(nil) | ||
expect(decision_issue.rating_profile_date).to eq(nil) | ||
expect(decision_issue.rating_promulgation_date).to eq(nil) | ||
expect(decision_issue.subject_text).to eq("This broadcast may not be reproduced") | ||
epe = EndProductEstablishment.find_by(reference_id: "20010065") | ||
expect(epe.synced_status).to eq("CLR") | ||
expect(epe.last_synced_at).to eq(1_702_067_145_000) | ||
expect(epe.code).to eq("030HLRR") | ||
expect(epe.development_item_reference_id).to eq(nil) | ||
review = epe.source | ||
expect(review.auto_remand).to eq(nil) | ||
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. Not sure if this is added to claim review models yet |
||
expect(review.informal_conference).to eq(nil) | ||
expect(review.same_office).to eq(nil) | ||
expect(review.legacy_opt_in_approved).to eq(false) | ||
end | ||
end | ||
|
||
context "API disabled" do | ||
before do | ||
FeatureToggle.enable!(:disable_ama_eventing) | ||
request.headers["Authorization"] = "Token token=#{api_key.key_string}" | ||
end | ||
|
||
it "when api is disabled" do | ||
post :decision_review_completed, params: valid_params | ||
expect(response).to have_http_status(501) | ||
expect(response.body).to include("API is disabled") | ||
end | ||
end | ||
|
||
context "Handling of duplicate events" do | ||
before do | ||
FeatureToggle.disable!(:disable_ama_eventing) | ||
request.headers["Authorization"] = "Token token=#{api_key.key_string}" | ||
end | ||
|
||
it "returns record already exists in Caseflow" do | ||
load_headers | ||
2.times { post :decision_review_completed, params: valid_params } | ||
expect(response).to have_http_status(:conflict) | ||
expect(response.body).to include("Record already exists in Caseflow") | ||
end | ||
end | ||
|
||
context "does not comlete on error" do | ||
KonstantinShevtsov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
before do | ||
FeatureToggle.disable!(:disable_ama_eventing) | ||
request.headers["Authorization"] = "Token token=#{api_key.key_string}" | ||
allow_any_instance_of(DecisionIssuesCompleteEvent).to receive(:perform!).and_raise(StandardError.new("Error")) | ||
end | ||
|
||
it "returns error" do | ||
post :decision_review_updated, params: valid_params | ||
expect(response).to have_http_status(:unprocessable_entity) | ||
expect(response.body).to include("Error") | ||
end | ||
end | ||
|
||
context "does not complete invalid params" do | ||
before do | ||
FeatureToggle.disable!(:disable_ama_eventing) | ||
request.headers["Authorization"] = "Token token=#{api_key.key_string}" | ||
end | ||
|
||
it "returns error" do | ||
post :decision_review_updated, params: invalid_params | ||
expect(response).to have_http_status(:unprocessable_entity) | ||
expect(response.body).to include("Error") | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Address this comment if we need it or remove it