TNl-6610 Fix "more" menu on discussion post for global staff.

This commit is contained in:
rabiaiftikhar
2017-03-03 15:27:35 +05:00
parent 0c30c06a78
commit ccfa3ea74d
2 changed files with 23 additions and 2 deletions

View File

@@ -1405,6 +1405,26 @@ class PermissionsTestCase(ModuleStoreTestCase):
'can_report': True
})
def test_get_ability_with_global_staff(self):
"""
Tests that global staff has rights to report other user's post inspite
of enrolled in the course or not.
"""
content = {'user_id': '1', 'type': 'thread'}
with mock.patch('django_comment_client.utils.check_permissions_by_view') as check_perm:
# check_permissions_by_view returns false because user is not enrolled in the course.
check_perm.return_value = False
global_staff = UserFactory(username='global_staff', email='global_staff@edx.org', is_staff=True)
self.assertEqual(utils.get_ability(None, content, global_staff), {
'editable': False,
'can_reply': False,
'can_delete': False,
'can_openclose': False,
'can_vote': False,
'can_report': True
})
def test_is_content_authored_by(self):
content = {}
user = mock.Mock()