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
c50f8281
Commit
c50f8281
authored
Mar 23, 2015
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes after rebase.
parent
e6c75529
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
18 deletions
+27
-18
lms/djangoapps/django_comment_client/forum/tests.py
+13
-12
lms/djangoapps/django_comment_client/tests/test_utils.py
+4
-2
openedx/core/djangoapps/course_groups/management/commands/tests/test_remove_users_from_multiple_cohorts.py
+2
-2
openedx/core/djangoapps/course_groups/tests/test_views.py
+4
-0
openedx/core/djangoapps/course_groups/views.py
+4
-2
No files found.
lms/djangoapps/django_comment_client/forum/tests.py
View file @
c50f8281
...
...
@@ -316,11 +316,11 @@ class SingleThreadQueryCountTestCase(ModuleStoreTestCase):
@ddt.data
(
# old mongo with cache: 15
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
21
,
15
,
30
),
(
ModuleStoreEnum
.
Type
.
mongo
,
50
,
315
,
15
,
30
),
(
ModuleStoreEnum
.
Type
.
mongo
,
1
,
21
,
15
,
40
,
27
),
(
ModuleStoreEnum
.
Type
.
mongo
,
50
,
315
,
15
,
628
,
27
),
# split mongo: 3 queries, regardless of thread response size.
(
ModuleStoreEnum
.
Type
.
split
,
1
,
3
,
3
,
30
),
(
ModuleStoreEnum
.
Type
.
split
,
50
,
3
,
3
,
30
),
(
ModuleStoreEnum
.
Type
.
split
,
1
,
3
,
3
,
40
,
27
),
(
ModuleStoreEnum
.
Type
.
split
,
50
,
3
,
3
,
628
,
27
),
)
@ddt.unpack
def
test_number_of_mongo_queries
(
...
...
@@ -329,7 +329,8 @@ class SingleThreadQueryCountTestCase(ModuleStoreTestCase):
num_thread_responses
,
num_uncached_mongo_calls
,
num_cached_mongo_calls
,
num_sql_queries
,
num_uncached_sql_queries
,
num_cached_sql_queries
,
mock_request
):
with
modulestore
()
.
default_store
(
default_store
):
...
...
@@ -371,15 +372,15 @@ class SingleThreadQueryCountTestCase(ModuleStoreTestCase):
backend
=
'django.core.cache.backends.dummy.DummyCache'
,
LOCATION
=
'single_thread_local_cache'
)
cached_calls
=
{
single_thread_dummy_cache
:
num_uncached_mongo_calls
,
single_thread_local_cache
:
num_cached_mongo_calls
}
for
single_thread_cache
,
expected_
calls
in
cached_calls
.
items
()
:
cached_calls
=
[
[
single_thread_dummy_cache
,
num_uncached_mongo_calls
,
num_uncached_sql_queries
]
,
[
single_thread_local_cache
,
num_cached_mongo_calls
,
num_cached_sql_queries
]
]
for
single_thread_cache
,
expected_
mongo_calls
,
expected_sql_queries
in
cached_calls
:
single_thread_cache
.
clear
()
with
patch
(
"django_comment_client.permissions.CACHE"
,
single_thread_cache
):
with
self
.
assertNumQueries
(
num
_sql_queries
):
with
check_mongo_calls
(
expected_calls
):
with
self
.
assertNumQueries
(
expected
_sql_queries
):
with
check_mongo_calls
(
expected_
mongo_
calls
):
call_single_thread
()
single_thread_cache
.
clear
()
...
...
lms/djangoapps/django_comment_client/tests/test_utils.py
View file @
c50f8281
...
...
@@ -17,6 +17,7 @@ from django_comment_client.tests.unicode import UnicodeTestMixin
from
django_comment_client.tests.utils
import
ContentGroupTestCase
import
django_comment_client.utils
as
utils
from
courseware.tests.factories
import
InstructorFactory
from
openedx.core.djangoapps.course_groups.cohorts
import
set_course_cohort_settings
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
...
...
@@ -186,6 +187,7 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
self
.
course
.
discussion_topics
=
{}
self
.
course
.
save
()
self
.
discussion_num
=
0
self
.
instructor
=
InstructorFactory
(
course_key
=
self
.
course
.
id
)
self
.
maxDiff
=
None
# pylint: disable=invalid-name
def
create_discussion
(
self
,
discussion_category
,
discussion_target
,
**
kwargs
):
...
...
@@ -199,12 +201,12 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
**
kwargs
)
def
assert_category_map_equals
(
self
,
expected
,
cohorted_if_in_list
=
False
,
exclude_unstarted
=
True
):
def
assert_category_map_equals
(
self
,
expected
,
cohorted_if_in_list
=
False
,
exclude_unstarted
=
True
):
# pylint: disable=arguments-differ
"""
Asserts the expected map with the map returned by get_discussion_category_map method.
"""
self
.
assertEqual
(
utils
.
get_discussion_category_map
(
self
.
course
,
cohorted_if_in_list
,
exclude_unstarted
),
utils
.
get_discussion_category_map
(
self
.
course
,
self
.
instructor
,
cohorted_if_in_list
,
exclude_unstarted
),
expected
)
...
...
openedx/core/djangoapps/course_groups/management/commands/tests/test_remove_users_from_multiple_cohorts.py
View file @
c50f8281
...
...
@@ -36,10 +36,10 @@ class TestMultipleCohortUsers(ModuleStoreTestCase):
"""
# set two auto_cohort_groups for both courses
config_course_cohorts
(
self
.
course1
,
[],
cohorted
=
True
,
auto_cohort_group
s
=
[
"Course1AutoGroup1"
,
"Course1AutoGroup2"
]
self
.
course1
,
is_cohorted
=
True
,
auto_cohort
s
=
[
"Course1AutoGroup1"
,
"Course1AutoGroup2"
]
)
config_course_cohorts
(
self
.
course2
,
[],
cohorted
=
True
,
auto_cohort_group
s
=
[
"Course2AutoGroup1"
,
"Course2AutoGroup2"
]
self
.
course2
,
is_cohorted
=
True
,
auto_cohort
s
=
[
"Course2AutoGroup1"
,
"Course2AutoGroup2"
]
)
# get the cohorts from the courses, which will cause auto cohorts to be created
...
...
openedx/core/djangoapps/course_groups/tests/test_views.py
View file @
c50f8281
...
...
@@ -7,6 +7,9 @@ import json
from
collections
import
namedtuple
from
datetime
import
datetime
from
unittest
import
skipUnless
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.http
import
Http404
from
django.test.client
import
RequestFactory
...
...
@@ -1193,6 +1196,7 @@ class RemoveUserFromCohortTestCase(CohortViewsTestCase):
self
.
verify_removed_user_from_cohort
(
user
.
username
,
response_dict
,
cohort
)
@skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Tests only valid in LMS'
)
class
CourseCohortDiscussionTopicsTestCase
(
CohortViewsTestCase
):
"""
Tests the `cohort_discussion_topics` view.
...
...
openedx/core/djangoapps/course_groups/views.py
View file @
c50f8281
...
...
@@ -103,7 +103,7 @@ def get_cohorted_discussions(course, course_settings):
cohorted_inline_discussions
=
[]
course_wide_discussions
=
[
topic
[
'id'
]
for
__
,
topic
in
course
.
discussion_topics
.
items
()]
all_discussions
=
get_discussion_categories_ids
(
course
,
include_all
=
True
)
all_discussions
=
get_discussion_categories_ids
(
course
,
None
,
include_all
=
True
)
for
cohorted_discussion_id
in
course_settings
.
cohorted_discussions
:
if
cohorted_discussion_id
in
course_wide_discussions
:
...
...
@@ -462,7 +462,9 @@ def cohort_discussion_topics(request, course_key_string):
course
=
get_course_with_access
(
request
.
user
,
'staff'
,
course_key
)
discussion_topics
=
{}
discussion_category_map
=
get_discussion_category_map
(
course
,
cohorted_if_in_list
=
True
,
exclude_unstarted
=
False
)
discussion_category_map
=
get_discussion_category_map
(
course
,
request
.
user
,
cohorted_if_in_list
=
True
,
exclude_unstarted
=
False
)
# We extract the data for the course wide discussions from the category map.
course_wide_entries
=
discussion_category_map
.
pop
(
'entries'
)
...
...
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