Skip to content

Commit

Permalink
define default and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Oct 1, 2024
1 parent 7afc01a commit 9fe243b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fixbackend/notification/user_notification_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ async def update_notification_settings(
value = await session.get(UserNotificationSettingsEntity, user_id)
if value is None:
value = UserNotificationSettingsEntity(
user_id=user_id, weekly_report=True, inactivity_reminder=True, tutorial=True
user_id=user_id,
weekly_report=True,
inactivity_reminder=True,
tutorial=True,
marketing=True,
)
session.add(value)
if weekly_report is not None:
Expand Down
3 changes: 3 additions & 0 deletions tests/fixbackend/notification/user_notification_repo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ async def test_user_notification_settings_repo(async_session_maker: AsyncSession
assert updated.weekly_report is False
assert updated.inactivity_reminder is True
assert updated.tutorial is False
assert updated.marketing is True

# get updated settings
settings = await repo.get_notification_settings(user.id)
assert settings.user_id == user.id
assert settings.weekly_report is False
assert settings.inactivity_reminder is True
assert settings.tutorial is False
assert settings.marketing is True

# update via email settings
updated = await repo.update_notification_settings(
Expand All @@ -56,3 +58,4 @@ async def test_user_notification_settings_repo(async_session_maker: AsyncSession
assert updated.weekly_report is True
assert updated.inactivity_reminder is False
assert updated.tutorial is True
assert updated.marketing is True

0 comments on commit 9fe243b

Please sign in to comment.