From dc7671aa6b507b7d8d9dbb81756fa6cba5bd139d Mon Sep 17 00:00:00 2001 From: Hillel Arnold Date: Tue, 6 Jun 2023 11:46:13 -0400 Subject: [PATCH] tighten check for digital objects --- process_request/routines.py | 2 +- process_request/tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/process_request/routines.py b/process_request/routines.py index 1e46f8f..d30f985 100644 --- a/process_request/routines.py +++ b/process_request/routines.py @@ -107,7 +107,7 @@ def is_submittable(self, item): elif item["restrictions"] == "closed": submit = False reason = "This item is currently unavailable for request. It will not be included in request. Reason: {}".format(item.get("restrictions_text")) - elif "digital" in item["preferred_instance"]["format"].lower(): + elif item["preferred_instance"]["format"].lower() == "digital_object": submit = False reason = "This item is already available online. It will not be included in request." elif item["restrictions"] == "conditional": diff --git a/process_request/tests.py b/process_request/tests.py index e20da6c..281bd88 100644 --- a/process_request/tests.py +++ b/process_request/tests.py @@ -267,7 +267,7 @@ def test_parse_item(self, mock_get_data): # Ensure objects with attached digital objects return correct message for format, submit in [ - ("Digital", False), ("Mixed materials", True), ("microfilm", True)]: + ("Digital", True), ("digital_object", False), ("Mixed materials", True), ("microfilm", True)]: mock_get_data.return_value[0]["preferred_instance"]["format"] = format parsed = Processor().parse_item(item["uri"], "https://dimes.rockarch.org") self.assertEqual(parsed["submit"], submit)