-
Notifications
You must be signed in to change notification settings - Fork 10
Refactor: add enrollment_littlepay token view #2934
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
Conversation
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
This PR will need to coordinate with the one for the I'm gonna go ahead and mark this as ready to review. I can help with resolving conflicts or rebasing the |
Putting this back in Draft while (someone) resolves the conflicts. |
update module name in dotted paths and imports so that tests are correct and pass.
it uses a namespace of `littlepay`
6f8dc9c
to
0ab6925
Compare
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.
OK I rebased on the latest main
(I hope I didn't break anything 😅)
- Tests are all passing ✅
- Was able to run through a full enrollment locally ✅
I did make one tiny change during the rebase: it hasn't been our pattern to use unittest.mock
directly in tests, we typically use the mocker
fixture provided by pytest-mock
. I adjusted one of the tests to follow our typical pattern for consistency.
@pytest.mark.django_db | ||
@pytest.mark.usefixtures("mocked_session_agency", "mocked_session_eligible") | ||
def test_token_valid(mocker, client): | ||
mocker.patch.object(Session, "access_token", "enrollment_token") |
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.
This was the adjustment:
Previously this test used the @patch()
decorator from unittest.mock
to override the Session.access_token
attribute with a PropertyMock
(also from unittest.mock
).
The small change was to use mocker.patch.object
on Session
to achieve the same result.
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.
Makes sense! Thanks for the adjustment
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.
Looks good! I also made sure that I could still enroll with Littlepay and everything worked.
Part of #2907
This PR moves the entire
token
view frombenefits.enrollment.views
intobenefits.enrollment_littlepay.views
. It also refactors the view into a class-based view.The URL for the view was moved under
enrollment_littlepay
with a namespace oflittlepay
so that the URL is something like<base URL>/littlepay/token
. The route was updated as well so that all consumers of the route use the new URL.Reviewing
Enrollment with Littlepay should still work.
Screenshot