From 67b97705c82daa3f82d4a51b1622ba1d5fb94361 Mon Sep 17 00:00:00 2001 From: Awais Ansari <79941147+awais-ansari@users.noreply.github.com> Date: Thu, 6 Jul 2023 12:17:29 +0500 Subject: [PATCH] refactor: update non-editable into snake case non_editable (#32654) --- .../core/djangoapps/notifications/base_notification.py | 10 +++++----- .../notifications/tests/test_base_notification.py | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openedx/core/djangoapps/notifications/base_notification.py b/openedx/core/djangoapps/notifications/base_notification.py index 4cc63ff52e..742a76b93b 100644 --- a/openedx/core/djangoapps/notifications/base_notification.py +++ b/openedx/core/djangoapps/notifications/base_notification.py @@ -31,7 +31,7 @@ COURSE_NOTIFICATION_TYPES = { 'email': True, 'push': True, 'info': 'Comment on post', - 'non-editable': ['web', 'email'], + 'non_editable': ['web', 'email'], 'content_template': _('<{p}><{strong}>{replier_name} replied on <{strong}>{author_name}' ' response to your post <{strong}>{post_title}'), 'content_context': { @@ -49,7 +49,7 @@ COURSE_NOTIFICATION_TYPES = { 'email': True, 'push': True, 'info': 'Response on post', - 'non-editable': [], + 'non_editable': [], 'content_template': _('<{p}><{strong}>{replier_name} responded to your ' 'post <{strong}>{post_title}'), 'content_context': { @@ -206,13 +206,13 @@ class NotificationTypeManager: @staticmethod def get_non_editable_notification_channels(notification_types): """ - Returns non-editable notification channels for the given notification types. + Returns non_editable notification channels for the given notification types. """ non_editable_notification_channels = {} for notification_type in notification_types: - if notification_type.get('non-editable', None): + if notification_type.get('non_editable', None): non_editable_notification_channels[notification_type.get('name')] = \ - notification_type.get('non-editable') + notification_type.get('non_editable') return non_editable_notification_channels @staticmethod diff --git a/openedx/core/djangoapps/notifications/tests/test_base_notification.py b/openedx/core/djangoapps/notifications/tests/test_base_notification.py index 318145e1d4..6248575d16 100644 --- a/openedx/core/djangoapps/notifications/tests/test_base_notification.py +++ b/openedx/core/djangoapps/notifications/tests/test_base_notification.py @@ -106,7 +106,7 @@ class NotificationPreferenceSyncManagerTest(ModuleStoreTestCase): 'email': True, 'push': True, 'info': '', - 'non-editable': [], + 'non_editable': [], 'content_template': '', 'content_context': {}, 'email_template': '', @@ -187,16 +187,16 @@ class NotificationPreferenceSyncManagerTest(ModuleStoreTestCase): def test_non_editable_addition_and_removal(self): """ - Tests if non-editable updates on existing preferences + Tests if non_editable updates on existing preferences """ current_config_version = get_course_notification_preference_config_version() - base_notification.COURSE_NOTIFICATION_TYPES[self.default_type_name]['non-editable'] = ['web'] + base_notification.COURSE_NOTIFICATION_TYPES[self.default_type_name]['non_editable'] = ['web'] self._set_notification_config_version(current_config_version + 1) new_config = CourseNotificationPreference.get_updated_user_course_preferences(self.user, self.course.id) preferences = new_config.notification_preference_config preference_non_editable = preferences[self.default_app_name]['non_editable'][self.default_type_name] assert 'web' in preference_non_editable - base_notification.COURSE_NOTIFICATION_TYPES[self.default_type_name]['non-editable'] = [] + base_notification.COURSE_NOTIFICATION_TYPES[self.default_type_name]['non_editable'] = [] self._set_notification_config_version(current_config_version + 2) new_config = CourseNotificationPreference.get_updated_user_course_preferences(self.user, self.course.id) preferences = new_config.notification_preference_config