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

Feat: model and capture local EnrollmentEvent #2367

Merged
merged 9 commits into from
Sep 18, 2024
Merged

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Sep 13, 2024

Closes #2267

Going to rebase on #2340 once that is merged, to add the EnrollmentEvent logic for in-person flows.

How to test

Permissions

Confirm the expected permissions behavior for the EnrollmentEvent model.

  1. Checkout this branch and open in the devcontainer
  2. Delete your local database and bin/reset_db.sh, using the default fixtures file
  3. F5 to launch the app
  4. Login in to the Admin as a superuser or member of STAFF_GROUP_NAME
  5. Confirm that you can view existing EnrollmentEvent records, and all fields are editable
  6. Confirm that you can manually add a new record, and its fields are editable once saved
  7. Confirm that you can delete existing records
  8. Stop the app, and add benefits.calitp.org to your list of ALLOWED_HOSTS, then restart the app
  9. Log into the Admin
  10. Confirm that you can still see existing EnrollmentEvent records, but now all fields read-only
  11. Confirm that you cannot create new records manually
  12. Confirm that you cannot delete existing records

Implementation

Confirm an EnrollmentEvent is created when expected.

Depends on the resolution of #2365

  1. Delete your local database and bin/reset_db.sh, using a fixtures file to setup a QA TransitProcessor connection for CST
  2. F5 to launch the app
  3. Run through an enrollment flow all the way to the final success screen
  4. Login in to the Admin as a superuser or member of STAFF_GROUP_NAME
  5. See a new EnrollmentEvent record for the enrollment you just completed (it should have enrollment_method=digital), confirm all fields are read-only
  6. Do the same for an in-person flow, running through all the way to the success screen
  7. See a new EnrollmentEvent record for the enrollment you just completed (it should have enrollment_method=in_person and your name as the verified_by)

@thekaveman thekaveman self-assigned this Sep 13, 2024
@github-actions github-actions bot added tests Related to automated testing (unit, UI, integration, etc.) deployment-dev [auto] Changes that will trigger a deploy if merged to dev migrations [auto] Review for potential model changes/needed data migrations updates back-end Django views, sessions, middleware, models, migrations etc. labels Sep 13, 2024
Copy link

github-actions bot commented Sep 13, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits
  settings.py
  benefits/core
  admin.py
  models.py
  benefits/enrollment
  views.py
  benefits/in_person
  views.py
Project Total  

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

@thekaveman thekaveman force-pushed the feat/enrollment-event branch 4 times, most recently from 78820b2 to ac1f54f Compare September 13, 2024 21:46
@thekaveman thekaveman changed the title Feat: model and capture enrollment events Feat: model and capture local enrollment events Sep 13, 2024
@thekaveman thekaveman force-pushed the feat/enrollment-event branch from ac1f54f to 5bdbfa5 Compare September 13, 2024 21:52
@thekaveman thekaveman changed the title Feat: model and capture local enrollment events Feat: model and capture local EnrollmentEvent Sep 13, 2024
@thekaveman thekaveman force-pushed the feat/enrollment-event branch 5 times, most recently from b09a2e2 to 4016df2 Compare September 16, 2024 22:14
@thekaveman thekaveman marked this pull request as ready for review September 16, 2024 22:17
@thekaveman thekaveman requested a review from a team as a code owner September 16, 2024 22:17
@thekaveman thekaveman force-pushed the feat/enrollment-event branch from 4016df2 to cd995e3 Compare September 17, 2024 15:13
@angela-tran
Copy link
Member

Reviewing this now

@thekaveman thekaveman force-pushed the feat/enrollment-event branch from cd995e3 to 3f4b765 Compare September 17, 2024 19:31
@thekaveman
Copy link
Member Author

I rebased on main to avoid a conflict with the migration from #2370

EnrollmentMethod helper class acts as a container for the constants
"digital" and "in_person"
return the local enrollment_datetime as a human-readable string, with
information about the agency and flow
when running in production EnrollmentEvent fields are readonly
ease this restriction for testing in other environments for superusers

helper class RUNTIME_ENVS to contain environment strings
refactor the view tests to move away from expiration vs. non-expiration;
this distinction isn't relevant in the tests since they are mocking
the enrollment.enroll() function, so expiration calculation never occurs

instead test an enrollment for eligibility API vs. claims verification,
the respective EnrollmentEvents should contain different data
prevent sending false positive events if the success view is requested
directly

this aligns with where error events are sent
moved the model_User test fixture so it could be re-used to confirm
the EnrollmentEvent.verified_by field for in-person
@thekaveman thekaveman force-pushed the feat/enrollment-event branch from 5215f5a to 784abb0 Compare September 18, 2024 03:28
@thekaveman
Copy link
Member Author

@angela-tran think we can sneak this in as part of the release today?

Copy link
Member

@angela-tran angela-tran left a comment

Choose a reason for hiding this comment

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

Code looks good. I tested this out locally, and it looks great!

image

And I see the id is read-only when viewing a specific enrollment event 👍

@thekaveman thekaveman merged commit feb06d2 into main Sep 18, 2024
15 checks passed
@thekaveman thekaveman deleted the feat/enrollment-event branch September 18, 2024 18:48
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 migrations [auto] Review for potential model changes/needed data migrations updates tests Related to automated testing (unit, UI, integration, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Model and capture local enrollment events
2 participants