From 9fe243bc0569b16b5eae0767253b320dfbd648cb Mon Sep 17 00:00:00 2001 From: Matthias Veit <matthias_veit@yahoo.de> Date: Tue, 1 Oct 2024 16:43:45 +0200 Subject: [PATCH] define default and add tests --- fixbackend/notification/user_notification_repo.py | 6 +++++- .../fixbackend/notification/user_notification_repo_test.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fixbackend/notification/user_notification_repo.py b/fixbackend/notification/user_notification_repo.py index 6c4a5ce7..8667bf27 100644 --- a/fixbackend/notification/user_notification_repo.py +++ b/fixbackend/notification/user_notification_repo.py @@ -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: diff --git a/tests/fixbackend/notification/user_notification_repo_test.py b/tests/fixbackend/notification/user_notification_repo_test.py index 2adf2359..54e6e155 100644 --- a/tests/fixbackend/notification/user_notification_repo_test.py +++ b/tests/fixbackend/notification/user_notification_repo_test.py @@ -41,6 +41,7 @@ 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) @@ -48,6 +49,7 @@ async def test_user_notification_settings_repo(async_session_maker: AsyncSession 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( @@ -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