From 80384b1fb661a1ae8273508bc60de84f221db609 Mon Sep 17 00:00:00 2001 From: dbernstein Date: Thu, 2 May 2024 14:37:08 -0700 Subject: [PATCH] PP-1219: Fixes overdrive monitor failures. (#1819) Resolves: https://ebce-lyrasis.atlassian.net/browse/PP-1219 --- api/overdrive.py | 12 +++--------- tests/api/test_overdrive.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/api/overdrive.py b/api/overdrive.py index a54cafeb60..d6cb21ce3f 100644 --- a/api/overdrive.py +++ b/api/overdrive.py @@ -311,7 +311,7 @@ class OverdriveAPI( METADATA_ENDPOINT = ( "%(host)s/v1/collections/%(collection_token)s/products/%(item_id)s/metadata" ) - EVENTS_ENDPOINT = "%(host)s/v1/collections/%(collection_token)s/products?lastUpdateTime=%(lastupdatetime)s&sort=%(sort)s&limit=%(limit)s" + EVENTS_ENDPOINT = "%(host)s/v1/collections/%(collection_token)s/products?lastUpdateTime=%(lastupdatetime)s&limit=%(limit)s" AVAILABILITY_ENDPOINT = "%(host)s/v2/collections/%(collection_token)s/products/%(product_id)s/availability" PATRON_INFORMATION_ENDPOINT = "%(patron_host)s/v1/patrons/me" @@ -2036,14 +2036,8 @@ class NewTitlesOverdriveCollectionMonitor(OverdriveCirculationMonitor): DEFAULT_START_TIME = OverdriveCirculationMonitor.NEVER MAX_CONSECUTIVE_OUT_OF_SCOPE_DATES = 1000 - def __init__( - self, - _db, - collection, - api_class=OverdriveAPI, - analytics: Analytics = Provide[Services.analytics.analytics], - ): - super().__init__(_db, collection, api_class, analytics) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) self._consecutive_items_out_of_scope = 0 def recently_changed_ids(self, start, cutoff): diff --git a/tests/api/test_overdrive.py b/tests/api/test_overdrive.py index 7931743fff..170986ab6b 100644 --- a/tests/api/test_overdrive.py +++ b/tests/api/test_overdrive.py @@ -2233,6 +2233,16 @@ def test_no_drm_fulfillment(self, overdrive_api_fixture: OverdriveAPIFixture): assert fulfill.content_link_redirect is True assert fulfill.content_link == "https://example.org/epub-redirect" + def test_no_recently_changed_books( + self, overdrive_api_fixture: OverdriveAPIFixture + ): + with patch.object( + overdrive_api_fixture.api, "_get_book_list_page" + ) as get_book_list: + get_book_list.return_value = ([], None) + result = overdrive_api_fixture.api.recently_changed_ids(utc_now(), None) + assert [i for i in result] == [] + class TestOverdriveAPICredentials: def test_patron_correct_credentials_for_multiple_overdrive_collections(