From ab4d85a5d1a17f503b6ade89ddaf9567746c4f5b Mon Sep 17 00:00:00 2001 From: wajeeha-khalid Date: Mon, 21 Sep 2015 11:44:17 +0500 Subject: [PATCH] MA-1305 - formatted author label to Staff & Community TA refactor community_ta and staff in docstrings --- lms/djangoapps/discussion_api/serializers.py | 8 ++++---- .../discussion_api/tests/test_serializers.py | 16 ++++++++-------- lms/djangoapps/discussion_api/views.py | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lms/djangoapps/discussion_api/serializers.py b/lms/djangoapps/discussion_api/serializers.py index f0c414274b..f107eafaa3 100644 --- a/lms/djangoapps/discussion_api/serializers.py +++ b/lms/djangoapps/discussion_api/serializers.py @@ -120,12 +120,12 @@ class _ContentSerializer(serializers.Serializer): def _get_user_label(self, user_id): """ - Returns the role label (i.e. "staff" or "community_ta") for the user + Returns the role label (i.e. "Staff" or "Community TA") for the user with the given id. """ return ( - "staff" if user_id in self.context["staff_user_ids"] else - "community_ta" if user_id in self.context["ta_user_ids"] else + "Staff" if user_id in self.context["staff_user_ids"] else + "Community TA" if user_id in self.context["ta_user_ids"] else None ) @@ -283,7 +283,7 @@ class CommentSerializer(_ContentSerializer): def get_endorsed_by_label(self, obj): """ - Returns the role label (i.e. "staff" or "community_ta") for the + Returns the role label (i.e. "Staff" or "Community TA") for the endorsing user """ endorsement = obj.get("endorsement") diff --git a/lms/djangoapps/discussion_api/tests/test_serializers.py b/lms/djangoapps/discussion_api/tests/test_serializers.py index b46149a8ee..66755a4745 100644 --- a/lms/djangoapps/discussion_api/tests/test_serializers.py +++ b/lms/djangoapps/discussion_api/tests/test_serializers.py @@ -94,11 +94,11 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin): self.assertEqual(actual_serialized_anonymous, expected_serialized_anonymous) @ddt.data( - (FORUM_ROLE_ADMINISTRATOR, False, "staff"), + (FORUM_ROLE_ADMINISTRATOR, False, "Staff"), (FORUM_ROLE_ADMINISTRATOR, True, None), - (FORUM_ROLE_MODERATOR, False, "staff"), + (FORUM_ROLE_MODERATOR, False, "Staff"), (FORUM_ROLE_MODERATOR, True, None), - (FORUM_ROLE_COMMUNITY_TA, False, "community_ta"), + (FORUM_ROLE_COMMUNITY_TA, False, "Community TA"), (FORUM_ROLE_COMMUNITY_TA, True, None), (FORUM_ROLE_STUDENT, False, None), (FORUM_ROLE_STUDENT, True, None), @@ -108,7 +108,7 @@ class SerializerTestMixin(CommentsServiceMockMixin, UrlResetMixin): """ Test correctness of the author_label field. - The label should be "staff", "staff", or "community_ta" for the + The label should be "Staff", "Staff", or "Community TA" for the Administrator, Moderator, and Community TA roles, respectively, but the label should not be present if the content is anonymous. @@ -352,9 +352,9 @@ class CommentSerializerTest(SerializerTestMixin, SharedModuleStoreTestCase): self.assertEqual(actual_endorser_anonymous, expected_endorser_anonymous) @ddt.data( - (FORUM_ROLE_ADMINISTRATOR, "staff"), - (FORUM_ROLE_MODERATOR, "staff"), - (FORUM_ROLE_COMMUNITY_TA, "community_ta"), + (FORUM_ROLE_ADMINISTRATOR, "Staff"), + (FORUM_ROLE_MODERATOR, "Staff"), + (FORUM_ROLE_COMMUNITY_TA, "Community TA"), (FORUM_ROLE_STUDENT, None), ) @ddt.unpack @@ -362,7 +362,7 @@ class CommentSerializerTest(SerializerTestMixin, SharedModuleStoreTestCase): """ Test correctness of the endorsed_by_label field. - The label should be "staff", "staff", or "community_ta" for the + The label should be "Staff", "Staff", or "Community TA" for the Administrator, Moderator, and Community TA roles, respectively. role_name is the name of the author's role. diff --git a/lms/djangoapps/discussion_api/views.py b/lms/djangoapps/discussion_api/views.py index 7e7bc2710a..2072e7b5db 100644 --- a/lms/djangoapps/discussion_api/views.py +++ b/lms/djangoapps/discussion_api/views.py @@ -358,8 +358,8 @@ class CommentViewSet(_ViewMixin, DeveloperErrorViewMixin, ViewSet): comment is anonymous * author_label: A label indicating whether the author has a special - role in the course, either "staff" for moderators and - administrators or "community_ta" for community TAs + role in the course, either "Staff" for moderators and + administrators or "Community TA" for community TAs * created_at: The ISO 8601 timestamp for the creation of the comment