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

Fix bug generating OPDS2 ODL notification URL #2126

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Oct 21, 2024

Description

Fix parameters passed to url_for to generate the URL for the OPDS2 + ODL notification endpoint. Previously I was passing patron_id and license_id, but the actual parameters were patron_identifier and license_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?

  • Running tests CI

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@jonathangreen jonathangreen added the bug Something isn't working label Oct 21, 2024
@jonathangreen jonathangreen requested a review from a team October 21, 2024 12:54
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.73%. Comparing base (801f8af) to head (8002c83).
Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@tdilauro tdilauro 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! 🛠️

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"
Copy link
Contributor

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?

Comment on lines 44 to 48
"""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.
"""
Copy link
Contributor

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?

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
Copy link
Contributor

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.

@jonathangreen jonathangreen merged commit 0e566c8 into main Oct 21, 2024
20 checks passed
@jonathangreen jonathangreen deleted the bugfix/odl-notification-url branch October 21, 2024 14:25
@jonathangreen jonathangreen restored the bugfix/odl-notification-url branch October 21, 2024 18:45
@jonathangreen jonathangreen deleted the bugfix/odl-notification-url branch October 21, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants