-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix bug generating OPDS2 ODL notification URL #2126
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2126 +/- ##
=======================================
Coverage 90.73% 90.73%
=======================================
Files 351 351
Lines 40904 40905 +1
Branches 8874 8875 +1
=======================================
+ Hits 37115 37117 +2
+ Misses 2481 2480 -1
Partials 1308 1308 ☔ View full report in Codecov by Sentry. |
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! 🛠️
A couple small things below...
@@ -421,6 +421,25 @@ def test_checkin_open_access( | |||
opds2_with_odl_api_fixture.patron, "pin", pool | |||
) | |||
|
|||
def test__notification_url(self): | |||
short_name = "short_name" |
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.
Since we go to the trouble of setting up the app context here, could we set our short_name
to "cm", pull in the fixture, and use this same test to verify that our fixture's _notification_url
stays in sync with the mainline version?
tests/mocks/odl.py
Outdated
"""Get the notification URL that should be passed in the ODL checkout link | ||
|
||
This is broken out into a separate function to make it easier to override | ||
in tests. | ||
""" |
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.
Did you mean to keep this comment from the mainline code here verbatim?
src/palace/manager/api/odl/api.py
Outdated
def _notification_url( | ||
short_name: str | None, patron_id: str, license_id: str | ||
) -> str: | ||
"""Get the notification URL that should be passed in the ODL checkout link |
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.
Very minor: Missing period at the end of the first sentence of the docstring.
Description
Fix parameters passed to
url_for
to generate the URL for the OPDS2 + ODL notification endpoint. Previously I was passingpatron_id
andlicense_id
, but the actual parameters werepatron_identifier
andlicense_identifier
.I did a little bit of light refactoring as well so I could add a better test, where we test the actual URL generation.
Motivation and Context
Testing the changes from #2117
How Has This Been Tested?
Checklist