Skip to content

Commit

Permalink
Fix broken tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein committed Nov 4, 2024
1 parent a9a99a3 commit e03180c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/manager/api/controller/test_loan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 3 additions & 1 deletion tests/manager/api/controller/test_urn_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions tests/manager/api/controller/test_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand 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"]

Expand Down
8 changes: 5 additions & 3 deletions tests/manager/core/test_app_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e03180c

Please sign in to comment.