forked from superdesk/superdesk-planning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
it gets set from ingest based on current time + provider config, which might be before the event actually happens SDCP-744
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest.mock as mock | ||
|
||
from . import TestCase | ||
|
||
from datetime import datetime | ||
|
||
from planning.events.events import overwrite_event_expiry_date | ||
|
||
|
||
class EventsExpiryTestCase(TestCase): | ||
def test_expiry(self): | ||
with mock.patch.dict(self.app.config, {"PLANNING_EXPIRY_MINUTES": 20}): | ||
with self.app.app_context(): | ||
item = {"dates": {"end": datetime(2050, 1, 1, 10, 0)}, "expiry": datetime.now()} | ||
overwrite_event_expiry_date(item) | ||
assert item["expiry"] == datetime(2050, 1, 1, 10, 20) | ||
|
||
updates = {"expiry": datetime.now()} | ||
overwrite_event_expiry_date(updates, item) | ||
assert updates["expiry"] == datetime(2050, 1, 1, 10, 20) | ||
|
||
updates = {"expiry": datetime.now(), "dates": {"end": datetime(2060, 1, 1, 10, 0)}} | ||
overwrite_event_expiry_date(updates, item) | ||
assert updates["expiry"] == datetime(2060, 1, 1, 10, 20) |