diff --git a/controller.py b/controller.py index 7f4c00b..8ef457d 100644 --- a/controller.py +++ b/controller.py @@ -22,7 +22,6 @@ from core.app_server import ( cdn_url_for, - feed_response, load_pagination_from_request, HeartbeatController, Pagination, @@ -68,6 +67,7 @@ from core.util.opds_writer import OPDSMessage from core.util.problem_detail import ProblemDetail from core.util.string_helpers import base64 +from core.util.flask_util import OPDSFeedResponse from coverage_provider import ( IdentifierResolutionCoverageProvider, @@ -484,7 +484,7 @@ def updates_feed(self, metadata_identifier): collection, **url_params ) - return feed_response(update_feed) + return OPDSFeedResponse(update_feed) def add_catalog_size_to_feed(self, feed, collection): """Add an tag to `feed` @@ -547,7 +547,7 @@ def add_items(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(addition_feed) + return OPDSFeedResponse(addition_feed) def add_with_metadata(self, metadata_identifier): """Adds identifiers with their metadata to a Collection's catalog""" @@ -636,7 +636,7 @@ def add_with_metadata(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(addition_feed) + return OPDSFeedResponse(addition_feed) def metadata_needed_for(self, metadata_identifier): """Returns identifiers in the collection that could benefit from @@ -696,7 +696,7 @@ def metadata_needed_for(self, metadata_identifier): 'metadata_needed_for', collection ) - return feed_response(request_feed) + return OPDSFeedResponse(request_feed) def remove_items(self, metadata_identifier): """Removes identifiers from a Collection's catalog""" @@ -749,7 +749,7 @@ def remove_items(self, metadata_identifier): precomposed_entries=messages ) - return feed_response(removal_feed) + return OPDSFeedResponse(removal_feed) def _in_catalog_subset(self, collection, identifiers_by_urn): """Helper method to find a subset of identifiers that diff --git a/core b/core index aa1f8b9..a19e86e 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit aa1f8b9e46fb2444a7a8a9b0776000fa3118631c +Subproject commit a19e86efce6061548108a9164877277d12d4c195 diff --git a/coverage_utils.py b/coverage_utils.py index e16872f..1cae636 100644 --- a/coverage_utils.py +++ b/coverage_utils.py @@ -44,7 +44,7 @@ def from_db(cls, _db, **kwargs): ) mirror = None mirrors = { ExternalIntegrationLink.COVERS : mirror, - ExternalIntegrationLink.BOOKS : None } + ExternalIntegrationLink.OPEN_ACCESS_BOOKS : None } return cls.from_metadata_source( mirrors=mirrors, **kwargs ) diff --git a/requirements.txt b/requirements.txt index 7df5095..12a5200 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,8 @@ money pymarc accept-types watchtower # for cloudwatch logging -pyspellchecker +pyspellchecker==0.5.6 +parameterized # nltk is a textblob dependency, and this is the last release that supports Python 2 nltk==3.4.5 diff --git a/tests/test_coverage_utils.py b/tests/test_coverage_utils.py index 97addf4..5b0ac0e 100644 --- a/tests/test_coverage_utils.py +++ b/tests/test_coverage_utils.py @@ -71,7 +71,7 @@ def test_from_db(self): # But the MirrorUploader is only to be used for book covers. The # metadata wrangler ignores the books themselves. - eq_(None, mirrors[ExternalIntegrationLink.BOOKS]) + eq_(None, mirrors[ExternalIntegrationLink.OPEN_ACCESS_BOOKS]) class TestMetadataWranglerBibliographicCoverageProvider(S3UploaderTest): diff --git a/tests/test_overdrive.py b/tests/test_overdrive.py index 92586b9..45bff93 100644 --- a/tests/test_overdrive.py +++ b/tests/test_overdrive.py @@ -3,6 +3,7 @@ eq_, set_trace, ) +import urllib from core.metadata_layer import ReplacementPolicy from core.s3 import MockS3Uploader from core.testing import ( @@ -52,10 +53,10 @@ def test_replacement_policy_uses_provided_mirror(self): # Now let's try looking up a specific identifier through 'Overdrive'. identifier = self._identifier( - Identifier.OVERDRIVE_ID, "3896665d-9d81-4cac-bd43-ffc5066de1f5" + identifier_type=Identifier.OVERDRIVE_ID, + foreign_id="3896665d-9d81-4cac-bd43-ffc5066de1f5" ) - body = self.data_file("overdrive/overdrive_metadata.json") provider.api.queue_response(200, {}, body) @@ -79,9 +80,9 @@ def test_replacement_policy_uses_provided_mirror(self): # The URLs for the Resource objects are our S3 URLs, not Overdrive's # URLs. - expect = "Overdrive/Overdrive+ID/%s" % identifier.identifier + expect = "Overdrive/Overdrive ID/%s" % identifier.identifier for url in [full.mirror_url, thumbnail.mirror_url]: - assert expect in url + assert urllib.quote(expect) in url assert "/scaled/" in thumbnail.mirror_url assert "/scaled/" not in full.mirror_url