From 9ba8d30caf806f50eabf6dae3868c4c03882e752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Tue, 4 Jun 2024 15:23:07 +0200 Subject: [PATCH] let onclusive ingest set item expiry (#2595) * let onclusive ingest set item expiry CPCN-825 * fix test --- superdesk/io/commands/update_ingest.py | 4 ++-- tests/io/update_ingest_tests.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/superdesk/io/commands/update_ingest.py b/superdesk/io/commands/update_ingest.py index 646451376c..45f6914870 100644 --- a/superdesk/io/commands/update_ingest.py +++ b/superdesk/io/commands/update_ingest.py @@ -769,8 +769,8 @@ def set_expiry(item, provider, parent_expiry=None): if item.get("dates") and item["dates"].get("end"): expiry_offset = item["dates"]["end"] - item["expiry"] = get_expiry_date( - provider.get("content_expiry") or app.config["INGEST_EXPIRY_MINUTES"], expiry_offset + item.setdefault( + "expiry", get_expiry_date(provider.get("content_expiry") or app.config["INGEST_EXPIRY_MINUTES"], expiry_offset) ) diff --git a/tests/io/update_ingest_tests.py b/tests/io/update_ingest_tests.py index 1e79556f7c..d5474a1235 100644 --- a/tests/io/update_ingest_tests.py +++ b/tests/io/update_ingest_tests.py @@ -259,8 +259,9 @@ def test_expiring_content_with_files(self): current_files = self.app.media.storage().fs("upload").find() self.assertEqual(4, current_files.count()) - remove = RemoveExpiredContent() - remove.run(provider.get("type")) + with patch("superdesk.io.commands.remove_expired_content.utcnow", return_value=now + timedelta(hours=20)): + remove = RemoveExpiredContent() + remove.run(provider.get("type")) # all gone current_files = self.app.media.storage().fs("upload").find()