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
ed81f767
Commit
ed81f767
authored
Oct 03, 2014
by
polesye
Committed by
Zia Fazal
Apr 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TNL-549: Fix thread editing.
parent
598dcea1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
lms/djangoapps/django_comment_client/base/tests.py
+15
-4
lms/djangoapps/django_comment_client/base/views.py
+1
-1
lms/djangoapps/django_comment_client/tests/test_utils.py
+0
-1
lms/djangoapps/django_comment_client/utils.py
+1
-1
No files found.
lms/djangoapps/django_comment_client/base/tests.py
View file @
ed81f767
...
@@ -181,8 +181,11 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
...
@@ -181,8 +181,11 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
super
(
ViewsTestCase
,
self
)
.
setUp
(
create_user
=
False
)
super
(
ViewsTestCase
,
self
)
.
setUp
(
create_user
=
False
)
# create a course
# create a course
self
.
course
=
CourseFactory
.
create
(
org
=
'MITx'
,
course
=
'999'
,
self
.
course
=
CourseFactory
.
create
(
display_name
=
'Robot Super Course'
)
org
=
'MITx'
,
course
=
'999'
,
discussion_topics
=
{
"Some Topic"
:
{
"id"
:
"some_topic"
}},
display_name
=
'Robot Super Course'
,
)
self
.
course_id
=
self
.
course
.
id
self
.
course_id
=
self
.
course
.
id
# seed the forums permissions and roles
# seed the forums permissions and roles
call_command
(
'seed_permissions_roles'
,
self
.
course_id
.
to_deprecated_string
())
call_command
(
'seed_permissions_roles'
,
self
.
course_id
.
to_deprecated_string
())
...
@@ -605,7 +608,15 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
...
@@ -605,7 +608,15 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
mock_request
mock_request
)
)
@patch
(
'django_comment_client.base.views.get_discussion_id_map'
,
return_value
=
{
"test_commentable"
:
{}})
def
test_update_thread_course_topic
(
self
,
mock_request
):
self
.
_setup_mock_request
(
mock_request
)
response
=
self
.
client
.
post
(
reverse
(
"update_thread"
,
kwargs
=
{
"thread_id"
:
"dummy"
,
"course_id"
:
self
.
course_id
.
to_deprecated_string
()}),
data
=
{
"body"
:
"foo"
,
"title"
:
"foo"
,
"commentable_id"
:
"some_topic"
}
)
self
.
assertEqual
(
response
.
status_code
,
200
)
@patch
(
'django_comment_client.base.views.get_discussion_categories_ids'
,
return_value
=
[
"test_commentable"
])
def
test_update_thread_wrong_commentable_id
(
self
,
mock_get_discussion_id_map
,
mock_request
):
def
test_update_thread_wrong_commentable_id
(
self
,
mock_get_discussion_id_map
,
mock_request
):
self
.
_test_request_error
(
self
.
_test_request_error
(
"update_thread"
,
"update_thread"
,
...
@@ -1101,7 +1112,7 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
...
@@ -1101,7 +1112,7 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
self
.
student
=
UserFactory
.
create
()
self
.
student
=
UserFactory
.
create
()
CourseEnrollmentFactory
(
user
=
self
.
student
,
course_id
=
self
.
course
.
id
)
CourseEnrollmentFactory
(
user
=
self
.
student
,
course_id
=
self
.
course
.
id
)
@patch
(
'django_comment_client.base.views.get_discussion_
id_map'
,
return_value
=
{
"test_commentable"
:
{}}
)
@patch
(
'django_comment_client.base.views.get_discussion_
categories_ids'
,
return_value
=
[
"test_commentable"
]
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
)
def
_test_unicode_data
(
self
,
text
,
mock_request
,
mock_get_discussion_id_map
):
def
_test_unicode_data
(
self
,
text
,
mock_request
,
mock_get_discussion_id_map
):
self
.
_set_mock_request_data
(
mock_request
,
{
self
.
_set_mock_request_data
(
mock_request
,
{
...
...
lms/djangoapps/django_comment_client/base/views.py
View file @
ed81f767
...
@@ -40,7 +40,7 @@ from django_comment_client.utils import (
...
@@ -40,7 +40,7 @@ from django_comment_client.utils import (
permalink
,
permalink
,
add_thread_group_name
,
add_thread_group_name
,
get_group_id_for_comments_service
,
get_group_id_for_comments_service
,
get_discussion_
id_map
,
get_discussion_
categories_ids
)
)
from
util.html
import
strip_tags
from
util.html
import
strip_tags
from
django_comment_client.permissions
import
check_permissions_by_view
,
cached_has_permission
from
django_comment_client.permissions
import
check_permissions_by_view
,
cached_has_permission
...
...
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
ed81f767
...
@@ -212,7 +212,6 @@ class CategoryMapTestCase(ModuleStoreTestCase):
...
@@ -212,7 +212,6 @@ class CategoryMapTestCase(ModuleStoreTestCase):
self
.
course
.
cohort_config
=
{
"cohorted"
:
False
,
"cohorted_discussions"
:
[
"Topic_A"
]}
self
.
course
.
cohort_config
=
{
"cohorted"
:
False
,
"cohorted_discussions"
:
[
"Topic_A"
]}
check_cohorted_topics
([])
check_cohorted_topics
([])
def
test_single_inline
(
self
):
def
test_single_inline
(
self
):
self
.
create_discussion
(
"Chapter"
,
"Discussion"
)
self
.
create_discussion
(
"Chapter"
,
"Discussion"
)
self
.
assertCategoryMapEquals
(
self
.
assertCategoryMapEquals
(
...
...
lms/djangoapps/django_comment_client/utils.py
View file @
ed81f767
...
@@ -96,7 +96,7 @@ def _filter_unstarted_categories(category_map):
...
@@ -96,7 +96,7 @@ def _filter_unstarted_categories(category_map):
unfiltered_queue
=
[
category_map
]
unfiltered_queue
=
[
category_map
]
filtered_queue
=
[
result_map
]
filtered_queue
=
[
result_map
]
while
len
(
unfiltered_queue
)
>
0
:
while
unfiltered_queue
:
unfiltered_map
=
unfiltered_queue
.
pop
()
unfiltered_map
=
unfiltered_queue
.
pop
()
filtered_map
=
filtered_queue
.
pop
()
filtered_map
=
filtered_queue
.
pop
()
...
...
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