Skip to content

Commit 86d9b08

Browse files
taimoor-ahmed-1Taimoor  Ahmed
andauthored
feat: remove last cs_comments service references (#37503)
This commit removes all remaining references to cs_comments_service except the ForumsConfig model. The only purpose of keeping the model and table around is so that the webapp processes don't start throwing errors during deployment because they're running the old code for a few minutes after the database migration has run. We can drop ForumsConfig and add the drop-table migration after Ulmo is cut. Also bumps the openedx-forum version to 0.3.7 --------- Co-authored-by: Taimoor Ahmed <[email protected]>
1 parent 604a87c commit 86d9b08

File tree

21 files changed

+46
-267
lines changed

21 files changed

+46
-267
lines changed

common/djangoapps/student/tests/test_admin_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def test_username_is_readonly_for_user(self):
200200
201201
Changing the username is still possible using the database or from the model directly.
202202
203-
However, changing the username might cause issues with the logs and/or the cs_comments_service since it
203+
However, changing the username might cause issues with the logs and/or the forum service since it
204204
stores the username in a different database.
205205
"""
206206
request = Mock()

lms/djangoapps/course_goals/tests/test_user_activity.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from common.djangoapps.student.tests.factories import UserFactory
2121
from common.djangoapps.util.testing import UrlResetMixin
2222
from lms.djangoapps.course_goals.models import UserActivity
23-
from openedx.core.djangoapps.django_comment_common.models import ForumsConfig
2423
from openedx.features.course_experience import ENABLE_COURSE_GOALS
2524

2625
User = get_user_model()
@@ -53,10 +52,6 @@ def setUp(self):
5352
self.request = RequestFactory().get('foo')
5453
self.request.user = self.user
5554

56-
config = ForumsConfig.current()
57-
config.enabled = True
58-
config.save()
59-
6055
def test_mfe_tabs_call_user_activity(self):
6156
'''
6257
New style tabs call one of two metadata endpoints

lms/djangoapps/discussion/django_comment_client/base/tests_v2.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
)
4949
from lms.djangoapps.discussion.django_comment_client.tests.utils import (
5050
CohortedTestCase,
51-
ForumsEnableMixin,
5251
)
5352
from lms.djangoapps.teams.tests.factories import (
5453
CourseTeamFactory,
@@ -397,7 +396,6 @@ def update_thread_helper(self):
397396
@disable_signal(views, "comment_flagged")
398397
@disable_signal(views, "thread_flagged")
399398
class ViewsTestCase(
400-
ForumsEnableMixin,
401399
MockForumApiMixin,
402400
UrlResetMixin,
403401
SharedModuleStoreTestCase,
@@ -1019,7 +1017,6 @@ def test_follow_unfollow_thread_signals(self, view_name, signal):
10191017

10201018
@disable_signal(views, "comment_endorsed")
10211019
class ViewPermissionsTestCase(
1022-
ForumsEnableMixin,
10231020
UrlResetMixin,
10241021
SharedModuleStoreTestCase,
10251022
MockForumApiMixin,
@@ -1733,7 +1730,7 @@ def test_create_sub_comment(self, user, commentable_id, status_code):
17331730
@disable_signal(views, "comment_created")
17341731
@ddt.ddt
17351732
class ForumEventTestCase(
1736-
ForumsEnableMixin, SharedModuleStoreTestCase, MockForumApiMixin
1733+
SharedModuleStoreTestCase, MockForumApiMixin
17371734
):
17381735
"""
17391736
Forum actions are expected to launch analytics events. Test these here.
@@ -2018,7 +2015,6 @@ def test_comment_event(self, mock_emit):
20182015

20192016
@disable_signal(views, "thread_edited")
20202017
class UpdateThreadUnicodeTestCase(
2021-
ForumsEnableMixin,
20222018
SharedModuleStoreTestCase,
20232019
UnicodeTestMixin,
20242020
MockForumApiMixin,
@@ -2084,7 +2080,7 @@ def _test_unicode_data(self, text, mock_get_discussion_id_map):
20842080

20852081

20862082
class CreateThreadUnicodeTestCase(
2087-
ForumsEnableMixin, SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
2083+
SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
20882084
):
20892085

20902086
@classmethod
@@ -2136,7 +2132,7 @@ def _test_unicode_data(self, text):
21362132

21372133
@disable_signal(views, "comment_created")
21382134
class CreateCommentUnicodeTestCase(
2139-
ForumsEnableMixin, SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
2135+
SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
21402136
):
21412137

21422138
@classmethod
@@ -2189,7 +2185,7 @@ def _test_unicode_data(self, text):
21892185

21902186
@disable_signal(views, "comment_edited")
21912187
class UpdateCommentUnicodeTestCase(
2192-
ForumsEnableMixin, SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
2188+
SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
21932189
):
21942190
@classmethod
21952191
def setUpClass(cls): # pylint: disable=super-method-not-called
@@ -2236,7 +2232,7 @@ def _test_unicode_data(self, text):
22362232

22372233
@disable_signal(views, "comment_created")
22382234
class CreateSubCommentUnicodeTestCase(
2239-
ForumsEnableMixin, SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
2235+
SharedModuleStoreTestCase, UnicodeTestMixin, MockForumApiMixin
22402236
):
22412237
"""
22422238
Make sure comments under a response can handle unicode.
@@ -2294,7 +2290,7 @@ def _test_unicode_data(self, text):
22942290
del Thread.commentable_id
22952291

22962292

2297-
class UsersEndpointTestCase(ForumsEnableMixin, SharedModuleStoreTestCase, MockForumApiMixin):
2293+
class UsersEndpointTestCase(SharedModuleStoreTestCase, MockForumApiMixin):
22982294

22992295
@classmethod
23002296
def setUpClass(cls): # pylint: disable=super-method-not-called
@@ -2468,7 +2464,7 @@ def _create_and_transform_event(**kwargs):
24682464

24692465

24702466
@ddt.ddt
2471-
class ForumThreadViewedEventTransformerTestCase(ForumsEnableMixin, UrlResetMixin, ModuleStoreTestCase):
2467+
class ForumThreadViewedEventTransformerTestCase(UrlResetMixin, ModuleStoreTestCase):
24722468
"""
24732469
Test that the ForumThreadViewedEventTransformer transforms events correctly
24742470
and without raising exceptions.

lms/djangoapps/discussion/django_comment_client/tests/test_utils.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@
3939
)
4040
from openedx.core.djangoapps.django_comment_common.comment_client.utils import (
4141
CommentClientMaintenanceError,
42-
perform_request,
4342
)
4443
from openedx.core.djangoapps.django_comment_common.models import (
4544
CourseDiscussionSettings,
4645
DiscussionsIdMapping,
47-
ForumsConfig,
4846
assign_role
4947
)
5048
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
@@ -1650,35 +1648,6 @@ def test_divided_outside_group(self, check_condition_function):
16501648
'can_report': True}
16511649

16521650

1653-
class ClientConfigurationTestCase(TestCase):
1654-
"""Simple test cases to ensure enabling/disabling the use of the comment service works as intended."""
1655-
1656-
def test_disabled(self):
1657-
"""Ensures that an exception is raised when forums are disabled."""
1658-
config = ForumsConfig.current()
1659-
config.enabled = False
1660-
config.save()
1661-
1662-
with pytest.raises(CommentClientMaintenanceError):
1663-
perform_request('GET', 'http://www.google.com')
1664-
1665-
@patch('requests.request')
1666-
def test_enabled(self, mock_request):
1667-
"""Ensures that requests proceed normally when forums are enabled."""
1668-
config = ForumsConfig.current()
1669-
config.enabled = True
1670-
config.save()
1671-
1672-
response = Mock()
1673-
response.status_code = 200
1674-
response.json = lambda: {}
1675-
1676-
mock_request.return_value = response
1677-
1678-
result = perform_request('GET', 'http://www.google.com')
1679-
assert result == {}
1680-
1681-
16821651
def set_discussion_division_settings(
16831652
course_key, enable_cohorts=False, always_divide_inline_discussions=False,
16841653
divided_discussions=[], division_scheme=CourseDiscussionSettings.COHORT

lms/djangoapps/discussion/django_comment_client/tests/utils.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,12 @@
1313
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
1414
from common.djangoapps.util.testing import UrlResetMixin
1515
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
16-
from openedx.core.djangoapps.django_comment_common.models import CourseDiscussionSettings, ForumsConfig, Role
16+
from openedx.core.djangoapps.django_comment_common.models import CourseDiscussionSettings, Role
1717
from openedx.core.djangoapps.django_comment_common.utils import seed_permissions_roles
1818
from openedx.core.lib.teams_config import TeamsConfig
1919

2020

21-
class ForumsEnableMixin:
22-
"""
23-
Ensures that the forums are enabled for a given test class.
24-
"""
25-
def setUp(self):
26-
super().setUp()
27-
28-
config = ForumsConfig.current()
29-
config.enabled = True
30-
config.save()
31-
32-
33-
class CohortedTestCase(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase):
21+
class CohortedTestCase(UrlResetMixin, SharedModuleStoreTestCase):
3422
"""
3523
Sets up a course with a student, a moderator and their cohorts.
3624
"""

lms/djangoapps/discussion/plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class DiscussionTab(TabFragmentViewMixin, EnrolledTab):
2222
"""
23-
A tab for the cs_comments_service forums.
23+
A tab for the forums.
2424
"""
2525

2626
type = 'discussion'

lms/djangoapps/discussion/rest_api/tests/test_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
from common.djangoapps.student.tests.factories import (
1717
UserFactory
1818
)
19-
from lms.djangoapps.discussion.django_comment_client.tests.utils import ForumsEnableMixin
2019
from lms.djangoapps.discussion.rest_api.api import get_user_comments
2120
from lms.djangoapps.discussion.rest_api.tests.utils import (
2221
ForumMockUtilsMixin,
@@ -29,7 +28,7 @@
2928

3029
@ddt.ddt
3130
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
32-
class GetUserCommentsTest(ForumsEnableMixin, ForumMockUtilsMixin, SharedModuleStoreTestCase):
31+
class GetUserCommentsTest(ForumMockUtilsMixin, SharedModuleStoreTestCase):
3332
"""
3433
Tests for get_user_comments.
3534
"""

lms/djangoapps/discussion/rest_api/tests/test_api_v2.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
)
4444
from common.djangoapps.util.testing import UrlResetMixin
4545
from common.test.utils import MockSignalHandlerMixin, disable_signal
46-
from lms.djangoapps.discussion.django_comment_client.tests.utils import (
47-
ForumsEnableMixin,
48-
)
4946
from lms.djangoapps.discussion.tests.utils import (
5047
make_minimal_cs_comment,
5148
make_minimal_cs_thread,
@@ -183,7 +180,6 @@ def _set_course_discussion_blackout(course, user_id):
183180
@disable_signal(api, "thread_voted")
184181
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
185182
class CreateThreadTest(
186-
ForumsEnableMixin,
187183
UrlResetMixin,
188184
SharedModuleStoreTestCase,
189185
MockSignalHandlerMixin,
@@ -601,7 +597,6 @@ def test_following(self):
601597
new=mock.Mock(),
602598
)
603599
class CreateCommentTest(
604-
ForumsEnableMixin,
605600
UrlResetMixin,
606601
SharedModuleStoreTestCase,
607602
MockSignalHandlerMixin,
@@ -1039,7 +1034,6 @@ def test_invalid_field(self):
10391034
@disable_signal(api, "thread_voted")
10401035
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
10411036
class UpdateThreadTest(
1042-
ForumsEnableMixin,
10431037
UrlResetMixin,
10441038
SharedModuleStoreTestCase,
10451039
MockSignalHandlerMixin,
@@ -1699,7 +1693,6 @@ def test_update_thread_with_close_reason_code(self, role_name, closed, mock_emit
16991693
@disable_signal(api, "comment_voted")
17001694
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
17011695
class UpdateCommentTest(
1702-
ForumsEnableMixin,
17031696
UrlResetMixin,
17041697
SharedModuleStoreTestCase,
17051698
MockSignalHandlerMixin,
@@ -2303,7 +2296,6 @@ def test_update_comment_with_edit_reason_code(self, role_name, mock_emit):
23032296
@disable_signal(api, "thread_deleted")
23042297
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
23052298
class DeleteThreadTest(
2306-
ForumsEnableMixin,
23072299
UrlResetMixin,
23082300
SharedModuleStoreTestCase,
23092301
MockSignalHandlerMixin,
@@ -2482,7 +2474,6 @@ def test_group_access(self, role_name, course_is_cohorted, thread_group_state):
24822474
@disable_signal(api, "comment_deleted")
24832475
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
24842476
class DeleteCommentTest(
2485-
ForumsEnableMixin,
24862477
UrlResetMixin,
24872478
SharedModuleStoreTestCase,
24882479
MockSignalHandlerMixin,
@@ -2672,7 +2663,6 @@ def test_group_access(self, role_name, course_is_cohorted, thread_group_state):
26722663
@ddt.ddt
26732664
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
26742665
class RetrieveThreadTest(
2675-
ForumsEnableMixin,
26762666
UrlResetMixin,
26772667
SharedModuleStoreTestCase,
26782668
ForumMockUtilsMixin,
@@ -2829,7 +2819,7 @@ def test_course_id_mismatch(self):
28292819
@ddt.ddt
28302820
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
28312821
class GetThreadListTest(
2832-
ForumsEnableMixin, ForumMockUtilsMixin, UrlResetMixin, SharedModuleStoreTestCase
2822+
ForumMockUtilsMixin, UrlResetMixin, SharedModuleStoreTestCase
28332823
):
28342824
"""Test for get_thread_list"""
28352825

@@ -3464,7 +3454,7 @@ def test_invalid_order_direction(self):
34643454
@ddt.ddt
34653455
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
34663456
class GetCommentListTest(
3467-
ForumsEnableMixin, SharedModuleStoreTestCase, ForumMockUtilsMixin
3457+
SharedModuleStoreTestCase, ForumMockUtilsMixin
34683458
):
34693459
"""Test for get_comment_list"""
34703460

@@ -4235,7 +4225,7 @@ def test_other_providers_ordering_error(self):
42354225

42364226
@mock.patch.dict("django.conf.settings.FEATURES", {"DISABLE_START_DATES": False})
42374227
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
4238-
class GetCourseTopicsTest(ForumMockUtilsMixin, ForumsEnableMixin, UrlResetMixin, ModuleStoreTestCase):
4228+
class GetCourseTopicsTest(ForumMockUtilsMixin, UrlResetMixin, ModuleStoreTestCase):
42394229
"""Test for get_course_topics"""
42404230
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
42414231
def setUp(self):
@@ -4673,7 +4663,7 @@ def test_discussion_topic(self):
46734663
@override_settings(DISCUSSION_MODERATION_EDIT_REASON_CODES={"test-edit-reason": "Test Edit Reason"})
46744664
@override_settings(DISCUSSION_MODERATION_CLOSE_REASON_CODES={"test-close-reason": "Test Close Reason"})
46754665
@ddt.ddt
4676-
class GetCourseTest(ForumsEnableMixin, UrlResetMixin, SharedModuleStoreTestCase):
4666+
class GetCourseTest(UrlResetMixin, SharedModuleStoreTestCase):
46774667
"""Test for get_course"""
46784668
@classmethod
46794669
def setUpClass(cls):
@@ -4754,7 +4744,7 @@ def test_privileged_roles(self, role):
47544744

47554745
@ddt.ddt
47564746
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
4757-
class GetCourseTestBlackouts(ForumsEnableMixin, UrlResetMixin, ModuleStoreTestCase):
4747+
class GetCourseTestBlackouts(UrlResetMixin, ModuleStoreTestCase):
47584748
"""
47594749
Tests of get_course for courses that have blackout dates.
47604750
"""

lms/djangoapps/discussion/rest_api/tests/test_serializers_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
from common.djangoapps.student.tests.factories import UserFactory
1818
from common.djangoapps.util.testing import UrlResetMixin
19-
from lms.djangoapps.discussion.django_comment_client.tests.utils import ForumsEnableMixin
2019
from lms.djangoapps.discussion.rest_api.serializers import CommentSerializer, ThreadSerializer, get_context
2120
from lms.djangoapps.discussion.rest_api.tests.utils import (
2221
ForumMockUtilsMixin,
@@ -36,7 +35,7 @@
3635

3736

3837
@ddt.ddt
39-
class CommentSerializerDeserializationTest(ForumsEnableMixin, ForumMockUtilsMixin, SharedModuleStoreTestCase):
38+
class CommentSerializerDeserializationTest(ForumMockUtilsMixin, SharedModuleStoreTestCase):
4039
"""Tests for ThreadSerializer deserialization."""
4140
@classmethod
4241
def setUpClass(cls):
@@ -387,7 +386,6 @@ def test_update_non_updatable(self, field):
387386

388387
@ddt.ddt
389388
class ThreadSerializerDeserializationTest(
390-
ForumsEnableMixin,
391389
ForumMockUtilsMixin,
392390
UrlResetMixin,
393391
SharedModuleStoreTestCase
@@ -535,7 +533,7 @@ def test_create_anonymous_to_peers(self):
535533

536534

537535
@ddt.ddt
538-
class SerializerTestMixin(ForumsEnableMixin, UrlResetMixin, ForumMockUtilsMixin):
536+
class SerializerTestMixin(UrlResetMixin, ForumMockUtilsMixin):
539537
"""
540538
Test Mixin for Serializer tests
541539
"""

lms/djangoapps/discussion/rest_api/tests/test_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from common.djangoapps.student.roles import CourseInstructorRole, CourseStaffRole
1212
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
1313
from lms.djangoapps.discussion.django_comment_client.tests.factories import RoleFactory
14-
from lms.djangoapps.discussion.django_comment_client.tests.utils import ForumsEnableMixin
1514
from lms.djangoapps.discussion.rest_api.tests.utils import CommentsServiceMockMixin
1615
from lms.djangoapps.discussion.rest_api.utils import (
1716
discussion_open_for_user,
@@ -182,7 +181,7 @@ def test_remove_empty_sequentials(self):
182181

183182

184183
@ddt.ddt
185-
class TestBlackoutDates(ForumsEnableMixin, CommentsServiceMockMixin, ModuleStoreTestCase):
184+
class TestBlackoutDates(CommentsServiceMockMixin, ModuleStoreTestCase):
186185
"""
187186
Test for the is_posting_allowed function
188187
"""

0 commit comments

Comments
 (0)