Skip to content
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

Refactor: introduce enrollment module #2338

Merged
merged 17 commits into from
Sep 10, 2024
Merged

Conversation

angela-tran
Copy link
Member

@angela-tran angela-tran commented Sep 5, 2024

Part of #2327

Refactors out logic from benefits.enrollment.views for calling the transit processor API out into a separate module. This will make it easier to reuse the logic for the in-person enrollment view.

Uses an Enum as the result of the enrollment attempt.

Manual testing

There shouldn't be any regressions to enrollment in the Benefits app.

this helps separate the business logic from the decision of what
response to return
make minimally needed changes to keep unit tests passing. they will
be refactored to separate the view logic from the business logic in a
separate commit.
@angela-tran angela-tran self-assigned this Sep 5, 2024
@github-actions github-actions bot added deployment-dev [auto] Changes that will trigger a deploy if merged to dev back-end Django views, sessions, middleware, models, migrations etc. tests Related to automated testing (unit, UI, integration, etc.) labels Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits/enrollment
  enrollment.py
  views.py
Project Total  

This report was generated by python-coverage-comment-action

it was easier for me to leave this until the end of all the refactoring
@angela-tran angela-tran marked this pull request as ready for review September 5, 2024 21:22
@angela-tran angela-tran requested a review from a team as a code owner September 5, 2024 21:22
lalver1
lalver1 previously approved these changes Sep 9, 2024
Copy link
Member

@lalver1 lalver1 left a comment

Choose a reason for hiding this comment

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

Looks good! 👍 I tested locally (also simulated a 500-level HTTP error) and enrollment worked as expected.

thekaveman
thekaveman previously approved these changes Sep 9, 2024
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

This is such a clean refactor, well done 💯 🥇

I only have 2 non-blocking comments:

  1. It would be helpful to have some docstrings for the new enroll helper, since that is used by callers external to the enrollment module.
  2. It seems like the token view function could also be refactored in a similar way, and re-use the same Status enum concept.

One or both of these can definitely be follow-ups.

@angela-tran angela-tran dismissed stale reviews from thekaveman and lalver1 via e4b4d7a September 10, 2024 00:41
@angela-tran
Copy link
Member Author

angela-tran commented Sep 10, 2024

  1. It would be helpful to have some docstrings for the new enroll helper, since that is used by callers external to the enrollment module.

Good idea. I added that in e4b4d7a - open to any suggestions or tweaks

  1. It seems like the token view function could also be refactored in a similar way, and re-use the same Status enum concept.

Yep, definitely. I think it makes sense as a follow-up PR. It is definitely needed for completeness in handling system errors and server errors, which I will create separate tickets to cover. edit: created #2345

Copy link
Member

@lalver1 lalver1 left a comment

Choose a reason for hiding this comment

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

👍

@angela-tran angela-tran merged commit c70789e into main Sep 10, 2024
15 checks passed
@angela-tran angela-tran deleted the refactor/enrollment-module branch September 10, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. deployment-dev [auto] Changes that will trigger a deploy if merged to dev tests Related to automated testing (unit, UI, integration, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants