fix quality
This commit is contained in:
@@ -236,6 +236,7 @@ class RetireViewTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@httpretty.activate
|
||||
@mock.patch('django.conf.settings.USERNAME_REPLACEMENT_WORKER', 'test_replace_username_service_worker')
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
|
||||
@@ -312,6 +313,7 @@ class ReplaceUsernameViewTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
|
||||
class CourseTopicsViewTest(DiscussionAPIViewTestMixin, ModuleStoreTestCase):
|
||||
|
||||
@@ -588,6 +588,7 @@ class RetireUserView(APIView):
|
||||
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
class ReplaceUsernameView(APIView):
|
||||
"""
|
||||
A request from the settings.USERNAME_REPLACEMENT_WORKER user can replace
|
||||
@@ -631,15 +632,6 @@ class ReplaceUsernameView(APIView):
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class CourseDiscussionSettingsAPIView(DeveloperErrorViewMixin, APIView):
|
||||
"""
|
||||
**Use Cases**
|
||||
|
||||
@@ -225,6 +225,7 @@ def _url_for_retire(user_id):
|
||||
"""
|
||||
return "{prefix}/users/{user_id}/retire".format(prefix=settings.PREFIX, user_id=user_id)
|
||||
|
||||
|
||||
def _url_for_username_replacement(user_id):
|
||||
"""
|
||||
Returns cs_comments_servuce url endpoint to replace the username of a user
|
||||
|
||||
@@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||
from django.conf import settings
|
||||
from rest_framework import permissions
|
||||
|
||||
|
||||
class CanDeactivateUser(permissions.BasePermission):
|
||||
"""
|
||||
Grants access to AccountDeactivationView if the requesting user is a superuser
|
||||
@@ -24,6 +25,7 @@ class CanRetireUser(permissions.BasePermission):
|
||||
def has_permission(self, request, view):
|
||||
return request.user.has_perm('accounts.can_retire_user')
|
||||
|
||||
|
||||
class CanReplaceUsername(permissions.BasePermission):
|
||||
"""
|
||||
Grants access to the Username Replacement API for anyone in the group,
|
||||
|
||||
@@ -1006,6 +1006,7 @@ class AccountRetirementView(ViewSet):
|
||||
for entitlement in CourseEntitlement.objects.filter(user_id=user.id):
|
||||
entitlement.courseentitlementsupportdetail_set.all().update(comments='')
|
||||
|
||||
|
||||
class UsernameReplacementView(APIView):
|
||||
"""
|
||||
WARNING: This API is only meant to be used as part of a larger job that
|
||||
@@ -1163,4 +1164,3 @@ class UsernameReplacementView(APIView):
|
||||
new=new_username,
|
||||
))
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user