Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
14d0ac01
Commit
14d0ac01
authored
Sep 05, 2014
by
Waqas Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5038 from mlkwaqas/waqas/tnl151-closed-thread-flag-post-error
Flagging posts in closed thread causes an error
parents
952eb215
ac2436f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
+36
-12
lms/djangoapps/django_comment_client/base/tests.py
+32
-8
lms/djangoapps/django_comment_client/permissions.py
+4
-4
No files found.
lms/djangoapps/django_comment_client/base/tests.py
View file @
14d0ac01
...
...
@@ -422,7 +422,13 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
data
=
{
"body"
:
updated_body
}
)
def
test_flag_thread
(
self
,
mock_request
):
def
test_flag_thread_open
(
self
,
mock_request
):
self
.
flag_thread
(
mock_request
,
False
)
def
test_flag_thread_close
(
self
,
mock_request
):
self
.
flag_thread
(
mock_request
,
True
)
def
flag_thread
(
self
,
mock_request
,
is_closed
):
mock_request
.
return_value
.
status_code
=
200
self
.
_set_mock_request_data
(
mock_request
,
{
"title"
:
"Hello"
,
...
...
@@ -434,7 +440,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
"created_at"
:
"2013-05-10T18:53:43Z"
,
"updated_at"
:
"2013-05-10T18:53:43Z"
,
"at_position_list"
:
[],
"closed"
:
False
,
"closed"
:
is_closed
,
"id"
:
"518d4237b023791dca00000d"
,
"user_id"
:
"1"
,
"username"
:
"robot"
,
"votes"
:
{
...
...
@@ -490,7 +496,13 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
assert_equal
(
response
.
status_code
,
200
)
def
test_un_flag_thread
(
self
,
mock_request
):
def
test_un_flag_thread_open
(
self
,
mock_request
):
self
.
un_flag_thread
(
mock_request
,
False
)
def
test_un_flag_thread_close
(
self
,
mock_request
):
self
.
un_flag_thread
(
mock_request
,
True
)
def
un_flag_thread
(
self
,
mock_request
,
is_closed
):
mock_request
.
return_value
.
status_code
=
200
self
.
_set_mock_request_data
(
mock_request
,
{
"title"
:
"Hello"
,
...
...
@@ -502,7 +514,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
"created_at"
:
"2013-05-10T18:53:43Z"
,
"updated_at"
:
"2013-05-10T18:53:43Z"
,
"at_position_list"
:
[],
"closed"
:
False
,
"closed"
:
is_closed
,
"id"
:
"518d4237b023791dca00000d"
,
"user_id"
:
"1"
,
"username"
:
"robot"
,
...
...
@@ -559,7 +571,13 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
assert_equal
(
response
.
status_code
,
200
)
def
test_flag_comment
(
self
,
mock_request
):
def
test_flag_comment_open
(
self
,
mock_request
):
self
.
flag_comment
(
mock_request
,
False
)
def
test_flag_comment_close
(
self
,
mock_request
):
self
.
flag_comment
(
mock_request
,
True
)
def
flag_comment
(
self
,
mock_request
,
is_closed
):
mock_request
.
return_value
.
status_code
=
200
self
.
_set_mock_request_data
(
mock_request
,
{
"body"
:
"this is a comment"
,
...
...
@@ -570,7 +588,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
"created_at"
:
"2013-05-10T18:53:43Z"
,
"updated_at"
:
"2013-05-10T18:53:43Z"
,
"at_position_list"
:
[],
"closed"
:
False
,
"closed"
:
is_closed
,
"id"
:
"518d4237b023791dca00000d"
,
"user_id"
:
"1"
,
"username"
:
"robot"
,
...
...
@@ -622,7 +640,13 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
assert_equal
(
response
.
status_code
,
200
)
def
test_un_flag_comment
(
self
,
mock_request
):
def
test_un_flag_comment_open
(
self
,
mock_request
):
self
.
un_flag_comment
(
mock_request
,
False
)
def
test_un_flag_comment_close
(
self
,
mock_request
):
self
.
un_flag_comment
(
mock_request
,
True
)
def
un_flag_comment
(
self
,
mock_request
,
is_closed
):
mock_request
.
return_value
.
status_code
=
200
self
.
_set_mock_request_data
(
mock_request
,
{
"body"
:
"this is a comment"
,
...
...
@@ -633,7 +657,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
"created_at"
:
"2013-05-10T18:53:43Z"
,
"updated_at"
:
"2013-05-10T18:53:43Z"
,
"at_position_list"
:
[],
"closed"
:
False
,
"closed"
:
is_closed
,
"id"
:
"518d4237b023791dca00000d"
,
"user_id"
:
"1"
,
"username"
:
"robot"
,
...
...
lms/djangoapps/django_comment_client/permissions.py
View file @
14d0ac01
...
...
@@ -106,10 +106,10 @@ VIEW_PERMISSIONS = {
'vote_for_comment'
:
[[
'vote'
,
'is_open'
]],
'undo_vote_for_comment'
:
[[
'unvote'
,
'is_open'
]],
'vote_for_thread'
:
[[
'vote'
,
'is_open'
]],
'flag_abuse_for_thread'
:
[
[
'vote'
,
'is_open'
]
],
'un_flag_abuse_for_thread'
:
[
[
'vote'
,
'is_open'
]
],
'flag_abuse_for_comment'
:
[
[
'vote'
,
'is_open'
]
],
'un_flag_abuse_for_comment'
:
[
[
'vote'
,
'is_open'
]
],
'flag_abuse_for_thread'
:
[
'vote'
],
'un_flag_abuse_for_thread'
:
[
'vote'
],
'flag_abuse_for_comment'
:
[
'vote'
],
'un_flag_abuse_for_comment'
:
[
'vote'
],
'undo_vote_for_thread'
:
[[
'unvote'
,
'is_open'
]],
'pin_thread'
:
[
'openclose_thread'
],
'un_pin_thread'
:
[
'openclose_thread'
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment