-
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
103296 update uploads controller unit tests #21139
base: master
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
…com:department-of-veterans-affairs/vets-api into 103296-update-uploads-controller-unit-tests
|
||
statuses, error_message = controller.send(:handle_file_uploads, form_id, parsed_form_data) | ||
|
||
# TODO: should this be nil, or 400/'Upload failed'? |
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.
I suspect this is because the retry logic inside handle_file_uploads
fails - that might cause [statuses, error_messages]
to be undefined, which is probably the source of these undefined method 'uniq' for nil
errors we see from time to time.
Not sure we need to do anything about this right now, but this is a good lead for a followup ticket to fix that bug.
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.
(To answer the question, I believe it should be 400/'Upload failed'
)
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.
Agreed. You're right - inside handle_file_uploads
, we're returning [statuses, error_messages]
without them necessarily having been initialized. 400/'Upload failed'
would definitely be more appropriate.
modules/ivc_champva/spec/requests/ivc_champva/v1/forms/uploads_spec.rb
Outdated
Show resolved
Hide resolved
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.
Nice work!
Note: Delete the description statements, complete each step. None are optional, but can be justified as to why they cannot be completed as written. Provide known gaps to testing that may raise the risk of merging to production.
Summary
else
condition, with corresponding unit tests, for invalid form IDs being passed tosubmit_supporting_documents
require_all_s3_success
feature is enabledhandle_uploads
tests for other error conditionssubmit_supporting_documents
tests for error conditionsget_attachment_ids_and_forms
tests to test method functionality, not mockssupporting_document_ids
tests to test method functionality, not mocksgenerate_attachment_ids
test, since the method does not exist and only tested mock functionalityRelated issue(s)
Testing done
else
condition onsubmit_supporting_documents
is validated with new unit tests, which test both successful and failure casesScreenshots
Note: Optional
What areas of the site does it impact?
uploads_controller
change now throws an error when an invalid form ID is passed to the controller, when previously we were returning a 204 even though nothing was done on the server; arguably this should be an error condition because the form ID is not submitted in this case. This would occur when submitting IVC CHAMPVA forms to the backend with an invalid form ID, which should not occur due to the way the front end is coded.Acceptance criteria
Requested Feedback
(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?