feat: enhance calendar ICS generation with event type filtering
All checks were successful
CI / lint-and-test (push) Successful in 22s
All checks were successful
CI / lint-and-test (push) Successful in 22s
- Added support for filtering calendar events by type in the ICS generation API endpoint, allowing users to specify whether to include only duty shifts or all event types (duty, unavailable, vacation). - Updated the `get_duties_for_user` function to accept an optional `event_types` parameter, enabling more flexible data retrieval based on user preferences. - Enhanced unit tests to cover the new event type filtering functionality, ensuring correct behavior and reliability of the ICS generation process.
This commit is contained in:
@@ -183,10 +183,14 @@ async def test_calendar_link_with_user_and_token_replies_with_url():
|
||||
"duty_teller.handlers.commands.create_calendar_token",
|
||||
return_value="abc43token",
|
||||
):
|
||||
with patch("duty_teller.handlers.commands.get_lang", return_value="en"):
|
||||
with patch(
|
||||
"duty_teller.handlers.commands.get_lang", return_value="en"
|
||||
):
|
||||
with patch("duty_teller.handlers.commands.t") as mock_t:
|
||||
mock_t.side_effect = lambda lang, key, **kw: (
|
||||
f"URL: {kw.get('url', '')}" if "success" in key else "Hint"
|
||||
f"URL: {kw.get('url', '')}"
|
||||
if "success" in key
|
||||
else "Hint"
|
||||
)
|
||||
await calendar_link(update, MagicMock())
|
||||
message.reply_text.assert_called_once()
|
||||
|
||||
Reference in New Issue
Block a user