Skip to content

Commit

Permalink
Remove deprecated ODL notify endpoint (#2120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen authored Nov 9, 2024
1 parent 0678bf3 commit 203fd47
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 45 deletions.
7 changes: 0 additions & 7 deletions src/palace/manager/api/controller/odl_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from palace.manager.sqlalchemy.model.credential import Credential
from palace.manager.sqlalchemy.model.licensing import License
from palace.manager.sqlalchemy.model.patron import Loan, Patron
from palace.manager.sqlalchemy.util import get_one
from palace.manager.util.datetime_helpers import utc_now
from palace.manager.util.log import LoggerMixin
from palace.manager.util.problem_detail import ProblemDetailException
Expand Down Expand Up @@ -63,12 +62,6 @@ def notify(
loan = self._get_loan(patron_identifier, license_identifier)
return self._process_notification(loan)

# TODO: This method is deprecated and should be removed once all the loans
# created using the old endpoint have expired.
def notify_deprecated(self, loan_id: int) -> Response:
loan = get_one(self.db, Loan, id=loan_id)
return self._process_notification(loan)

def _process_notification(self, loan: Loan | None) -> Response:
status_doc_json = flask.request.data

Expand Down
10 changes: 0 additions & 10 deletions src/palace/manager/api/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,6 @@ def saml_callback():
)


# TODO: This is a deprecated route that will be removed in a future release of the code,
# its left here for now to provide a dummy endpoint for existing ODL loans. All
# new loans will use the new endpoint.
@library_route("/odl_notify/<loan_id>", methods=["GET", "POST"])
@has_library
@raises_problem_detail
def odl_notify(loan_id) -> Response:
return app.manager.odl_notification_controller.notify_deprecated(loan_id)


# Loan notifications for OPDS + ODL distributors
@library_route("/odl/notify/<patron_identifier>/<license_identifier>", methods=["POST"])
@has_library
Expand Down
21 changes: 0 additions & 21 deletions tests/manager/api/controller/test_odl_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,27 +167,6 @@ def test_notify_success(

assert loan.end == utc_now()

@freeze_time()
def test_notify_deprecated(
self,
flask_app_fixture: FlaskAppFixture,
odl_fixture: ODLFixture,
) -> None:
loan = odl_fixture.create_loan()
assert loan.end != utc_now()
status_doc = odl_fixture.loan_status_document("revoked")
with flask_app_fixture.test_request_context(
"/",
method="POST",
data=status_doc.model_dump_json(),
library=odl_fixture.library,
):
assert loan.id is not None
response = odl_fixture.controller.notify_deprecated(loan.id)
assert response.status_code == 204

assert loan.end == utc_now()

def test_notify_errors(
self,
db: DatabaseTransactionFixture,
Expand Down
7 changes: 0 additions & 7 deletions tests/manager/api/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,6 @@ def fixture(self, route_test: RouteTestFixture) -> RouteTestFixture:
route_test.set_controller_name(self.CONTROLLER_NAME)
return route_test

def test_odl_notify_deprecated(self, fixture: RouteTestFixture):
url = "/odl_notify/<loan_id>"
fixture.assert_request_calls(
url, fixture.controller.notify_deprecated, "<loan_id>"
)
fixture.assert_supported_methods(url, "GET", "POST")

def test_odl_notify(self, fixture: RouteTestFixture):
url = "/odl/notify/<patron_identifier>/<license_identifier>"
fixture.assert_request_calls(
Expand Down

0 comments on commit 203fd47

Please sign in to comment.