Skip to content

Commit

Permalink
Merge pull request #23 from petrjasek/set-planning-all-day
Browse files Browse the repository at this point in the history
set incoming planning to last all day
  • Loading branch information
petrjasek authored Dec 20, 2023
2 parents 59d8d11 + 388ef15 commit 413b727
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions server/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
INSTALLED_APPS = [
"stt.external_links",
"stt.filters",
"stt.signals",
"newsroom.auth.saml",
]

Expand Down
4 changes: 2 additions & 2 deletions server/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ max-line-length = 120
exclude = env,venv,node_modules,build

[tool:pytest]
testpaths = stt_tests
confcutdir = stt_tests
testpaths = tests
confcutdir = tests
addopts = --tb=short

[mypy]
Expand Down
10 changes: 10 additions & 0 deletions server/stt/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

from newsroom.signals import publish_planning


def set_planning_all_day(app, item, **kwargs):
item["dates"].setdefault("all_day", True)


def init_app(app):
publish_planning.connect(set_planning_all_day)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions server/tests/test_signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

from stt.signals import publish_planning, set_planning_all_day


def test_publish_planning_signal():
publish_planning.connect(set_planning_all_day)
item = {"dates": {"start": 1, "end": 1}}
publish_planning.send(None, item=item, foo=1)
assert item["dates"]["all_day"] is True
File renamed without changes.

0 comments on commit 413b727

Please sign in to comment.