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: Agency card direct route #2312

Merged
merged 6 commits into from
Aug 26, 2024
Merged

Feat: Agency card direct route #2312

merged 6 commits into from
Aug 26, 2024

Conversation

thekaveman
Copy link
Member

@thekaveman thekaveman commented Aug 20, 2024

Closes #2252

Edited the URL to be /{slug}/agency-card per #2252 (comment)

In addition to the tasks of #2252, this also refactors the one other agency-specific shortcut route to normalize it into the same pattern as the now (2) other agency-specific shortcut routes.

Instead of:

  • /cst/agency-card
  • /cst/publickey
  • /eligibility/cst

We now have:

  • /cst/agency-card
  • /cst/publickey
  • /cst/eligibility

This route is used on the agency selector modal: it is the route the user goes through to get to eligibility:index when they start at the core:index (which stores the transit agency selection in the user's session).

This differs slightly from the agency index page core:agency_index; in that case, although the transit agency is also stored in the user's session, the user's CTA on the page is a single button that does not use this shortcut, but goes directly to the /eligibility page (since the transit agency is already configured in the session).

I also refactored the pytest model fixtures a bit to get them into a shape that I could more easily use to test this new functionality.

Testing

  1. Run this branch locally with F5
  2. Visit /cst/agency-card --> you should be redirected to the eligibility:confirm page
  3. Create a brand new Eligibility API flow instance; add both to CST
  4. Visit /cst/agency-card --> you should be redirected to the eligibility:confirm page with the newer flow selected
  5. In the admin, configure CST to not have any Eligibility API flows
  6. Visit /cst/agency-card --> you should be redirected to the user error page

@github-actions github-actions bot added back-end Django views, sessions, middleware, models, migrations etc. tests Related to automated testing (unit, UI, integration, etc.) migrations [auto] Review for potential model changes/needed data migrations updates and removed tests Related to automated testing (unit, UI, integration, etc.) labels Aug 20, 2024
Copy link

github-actions bot commented Aug 20, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  benefits
  routes.py
  benefits/core
  models.py
  views.py
  benefits/eligibility
  views.py
Project Total  

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

@thekaveman thekaveman force-pushed the feat/agencycard-route branch 2 times, most recently from 28f740b to 7fc1309 Compare August 20, 2024 15:49
@thekaveman thekaveman self-assigned this Aug 20, 2024
Base automatically changed from refactor/routes to main August 20, 2024 19:20
@thekaveman thekaveman force-pushed the feat/agencycard-route branch from 7fc1309 to 68ab430 Compare August 20, 2024 19:21
@thekaveman thekaveman marked this pull request as ready for review August 20, 2024 19:26
@thekaveman thekaveman requested a review from a team as a code owner August 20, 2024 19:26
@thekaveman thekaveman force-pushed the feat/agencycard-route branch 2 times, most recently from 388b9db to 49a27f6 Compare August 22, 2024 23:18
@lalver1
Copy link
Member

lalver1 commented Aug 23, 2024

The code looks good to me and it was helpful to see how to normalize the structure of all agency redirects 👍
I also followed the testing steps and got the expected results ✅

* one default generic, not fully configured
* one configured for claims validation
* one configured for eligibility verification

this makes it clearer which one to use for a given case, and cleans up a
number of other fixtures and tests
initialize user's session for agency, and then for
the last (only) eligibility API flow found (the normal case)

"last" here is ordering by pk, which is implicitly ordering
on when flow objects were created in the database, so in the
(very edge, currently unsupported) case of multiple eligibility API
flows, this picks the most recent one that was defined
normalize the structure of all agency redirects into the form:

/{agency.slug}/{redirect}

e.g.

/cst/agencycard
/cst/eligibility

vs. the inconsistent mix before:

/cst/agencycard
/eligibility/cst
@thekaveman thekaveman force-pushed the feat/agencycard-route branch from 49a27f6 to 69175d6 Compare August 26, 2024 16:53
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.

This looks good to me. Tested it locally too

@thekaveman thekaveman merged commit e865673 into main Aug 26, 2024
17 checks passed
@thekaveman thekaveman deleted the feat/agencycard-route branch August 26, 2024 21:13
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. migrations [auto] Review for potential model changes/needed data migrations updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a route to support sending users directly to eligibility:confirm
3 participants