Skip to content

Commit

Permalink
let onclusive ingest set item expiry (#2595)
Browse files Browse the repository at this point in the history
* let onclusive ingest set item expiry

CPCN-825

* fix test
  • Loading branch information
petrjasek authored Jun 4, 2024
1 parent 0da3144 commit 9ba8d30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions superdesk/io/commands/update_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)


Expand Down
5 changes: 3 additions & 2 deletions tests/io/update_ingest_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9ba8d30

Please sign in to comment.