From e03180c98a323d99f2c5c924d1bd8e41328f4092 Mon Sep 17 00:00:00 2001 From: Daniel Bernstein Date: Mon, 4 Nov 2024 07:59:25 -0800 Subject: [PATCH] Fix broken tests. --- tests/manager/api/controller/test_loan.py | 2 +- tests/manager/api/controller/test_urn_lookup.py | 4 +++- tests/manager/api/controller/test_work.py | 8 ++++++-- tests/manager/core/test_app_server.py | 8 +++++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/manager/api/controller/test_loan.py b/tests/manager/api/controller/test_loan.py index e9c69a821f..50c04ef61d 100644 --- a/tests/manager/api/controller/test_loan.py +++ b/tests/manager/api/controller/test_loan.py @@ -154,7 +154,7 @@ def verify_and_get_single_entry_feed_links(self, response): if self.expected_content_type == OPDSFeed.ENTRY_TYPE: feed = feedparser.parse(response.get_data()) [entry] = feed["entries"] - elif self.expected_content_type == OPDS2Version1Serializer.CONTENT_TYPE: + elif self.expected_content_type == OPDS2Serializer.CONTENT_TYPE: entry = response.get_json() else: assert ( diff --git a/tests/manager/api/controller/test_urn_lookup.py b/tests/manager/api/controller/test_urn_lookup.py index c137de025b..d0b8ed4b64 100644 --- a/tests/manager/api/controller/test_urn_lookup.py +++ b/tests/manager/api/controller/test_urn_lookup.py @@ -20,7 +20,9 @@ def test_work_lookup(self, controller_fixture: ControllerFixture): # We got an OPDS feed. assert 200 == response.status_code - assert OPDSFeed.ACQUISITION_FEED_TYPE == response.headers["Content-Type"] + assert response.headers["Content-Type"].starts( + OPDSFeed.ACQUISITION_FEED_TYPE + ) # Parse it. feed = feedparser.parse(response.data) diff --git a/tests/manager/api/controller/test_work.py b/tests/manager/api/controller/test_work.py index b4ee11410a..d7ce1935c3 100644 --- a/tests/manager/api/controller/test_work.py +++ b/tests/manager/api/controller/test_work.py @@ -121,7 +121,9 @@ def test_contributor(self, work_fixture: WorkFixture): with work_fixture.request_context_with_library("/"): response = m(contributor, "eng,spa", "Children,Young Adult") assert 200 == response.status_code - assert OPDSFeed.ACQUISITION_FEED_TYPE == response.headers["Content-Type"] + assert response.headers["Content-Type"].startswith( + OPDSFeed.ACQUISITION_FEED_TYPE + ) feed = feedparser.parse(response.data) # The feed is named after the person we looked up. @@ -673,7 +675,9 @@ def test_related_books(self, work_fixture: WorkFixture): novelist_api=mock_api, ) assert 200 == response.status_code - assert OPDSFeed.ACQUISITION_FEED_TYPE == response.headers["content-type"] + assert response.headers["content-type"].startswith( + OPDSFeed.ACQUISITION_FEED_TYPE + ) feed = feedparser.parse(response.data) assert "Related Books" == feed["feed"]["title"] diff --git a/tests/manager/core/test_app_server.py b/tests/manager/core/test_app_server.py index f72b2e9cf0..8497564497 100644 --- a/tests/manager/core/test_app_server.py +++ b/tests/manager/core/test_app_server.py @@ -299,8 +299,8 @@ def test_work_lookup( # We got an OPDS feed that includes an entry for the work. assert 200 == response.status_code - assert ( - OPDSFeed.ACQUISITION_FEED_TYPE == response.headers["Content-Type"] + assert response.headers["Content-Type"].startswith( + OPDSFeed.ACQUISITION_FEED_TYPE ) response_data = response.data.decode("utf8") assert identifier.urn in response_data @@ -340,7 +340,9 @@ def test_permalink(self, urn_lookup_controller_fixture: URNLookupControllerFixtu # We got an OPDS feed that includes an entry for the work. assert 200 == response.status_code - assert OPDSFeed.ACQUISITION_FEED_TYPE == response.headers["Content-Type"] + assert response.headers["Content-Type"].startswith( + OPDSFeed.ACQUISITION_FEED_TYPE + ) response_data = response.data.decode("utf8") assert identifier.urn in response_data assert work.title in response_data