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

Give OPDS importers an API class (PP-501) #1442

Merged
merged 8 commits into from
Oct 18, 2023

Conversation

jonathangreen
Copy link
Member

Description

Previously OPDS importers were a special case, they had no API class, there there was a special code path for checkouts and fulfillment taken. Now they are treated like every other license source, with their own BaseCirculationAPI.

Motivation and Context

This is another step along the path to removing external integrations from license source integrations.

How Has This Been Tested?

  • Running tests

Checklist

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

@jonathangreen jonathangreen changed the title Give OPDS importers an API class (PP-500) Give OPDS importers an API class (PP-501) Oct 10, 2023
@jonathangreen jonathangreen force-pushed the feature/opds-importer-api branch from b3bfed8 to 139ec87 Compare October 16, 2023 14:54
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (f854e56) 90.38% compared to head (078ae8c) 90.40%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1442      +/-   ##
==========================================
+ Coverage   90.38%   90.40%   +0.01%     
==========================================
  Files         233      231       -2     
  Lines       29713    29718       +5     
  Branches     6793     6874      +81     
==========================================
+ Hits        26857    26867      +10     
+ Misses       1823     1822       -1     
+ Partials     1033     1029       -4     
Flag Coverage Δ
Api 74.06% <96.83%> (-0.01%) ⬇️
Core 60.99% <79.11%> (+0.04%) ⬆️
migration 28.90% <70.88%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
api/admin/controller/integration_settings.py 90.75% <100.00%> (ø)
api/admin/controller/patron_auth_services.py 96.00% <100.00%> (ø)
api/admin/controller/settings.py 78.39% <100.00%> (-1.49%) ⬇️
api/authentication/base.py 95.73% <100.00%> (+1.15%) ⬆️
api/authentication/basic.py 98.26% <100.00%> (-0.03%) ⬇️
api/discovery/opds_registration.py 95.60% <100.00%> (ø)
api/firstbook2.py 95.77% <100.00%> (+0.18%) ⬆️
api/integration/registry/license_providers.py 100.00% <100.00%> (ø)
api/integration/registry/patron_auth.py 100.00% <100.00%> (ø)
api/kansas_patron.py 98.55% <100.00%> (+0.06%) ⬆️
... and 12 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen force-pushed the feature/opds-importer-api branch from bd11b38 to 6513307 Compare October 17, 2023 17:04
@jonathangreen jonathangreen requested a review from a team October 17, 2023 18:01
@tdilauro tdilauro self-requested a review October 17, 2023 21:23
@tdilauro
Copy link
Contributor

I started a review of this today and plan to finish it up tomorrow.

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.

This looks really good! Just a few really small issues.

@@ -15,7 +21,7 @@
from tests.mocks.search import ExternalSearchIndexFake


class MockBaseCirculationAPI(BaseCirculationAPI, ABC):
class MockBaseCirculationAPI(PatronActivityCirculationAPI, ABC):
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this should get a different name, MockPatronActivityCirculationAPI, to avoid confusion about what is being mocked.

tests/fixtures/odl.py Show resolved Hide resolved
Comment on lines 36 to 37
@staticmethod
def _queue_response(self, status_code, headers={}, content=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is decorated as a static method, but accepts and uses self. If this is intentional, it would be helpful to use a different name for self and add a comment about what is happening.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment to clarify.

@jonathangreen jonathangreen force-pushed the feature/opds-importer-api branch from 507c8e7 to 078ae8c Compare October 18, 2023 15:59
@jonathangreen
Copy link
Member Author

Rebased on main, and made code review changes.

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! 🚀

@jonathangreen jonathangreen merged commit f79db78 into main Oct 18, 2023
26 of 27 checks passed
@jonathangreen jonathangreen deleted the feature/opds-importer-api branch October 18, 2023 16:25
jonathangreen added a commit that referenced this pull request Oct 20, 2023
As a follow up to #1442, this removes the CirculationFulfillmentPostProcessor class. All the logic has been moved into the OPDSAPI and OPDS2API classes. CirculationFulfillmentPostProcessor were only used to work around OPDS importers not having an API class. Now that we have a proper API class there, there is no reason to keep them around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants