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
55d2f1d5
Commit
55d2f1d5
authored
Dec 16, 2014
by
jsa
Committed by
Andy Armstrong
Jan 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test that students are auto-assigned to cohorts in partition scheme
parent
6fb3daa7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py
+28
-3
No files found.
openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py
View file @
55d2f1d5
...
...
@@ -16,13 +16,13 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from
..partition_scheme
import
CohortPartitionScheme
from
..models
import
CourseUserGroupPartitionGroup
from
..cohorts
import
add_user_to_cohort
from
..cohorts
import
add_user_to_cohort
,
get_course_cohorts
from
.helpers
import
CohortFactory
,
config_course_cohorts
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
TEST_MAPPING
=
{
'edX/toy/2012_Fall'
:
'xml'
}
TEST_DATA_MIXED_MODULESTORE
=
mixed_store_config
(
TEST_DATA_DIR
,
TEST_MAPPING
)
TEST_DATA_MIXED_MODULESTORE
=
mixed_store_config
(
TEST_DATA_DIR
,
TEST_MAPPING
,
include_xml
=
True
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
...
...
@@ -37,7 +37,8 @@ class TestCohortPartitionScheme(django.test.TestCase):
and a student for each test.
"""
self
.
course_key
=
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
config_course_cohorts
(
modulestore
()
.
get_course
(
self
.
course_key
),
[],
cohorted
=
True
)
self
.
course
=
modulestore
()
.
get_course
(
self
.
course_key
)
config_course_cohorts
(
self
.
course
,
[],
cohorted
=
True
)
self
.
groups
=
[
Group
(
10
,
'Group 10'
),
Group
(
20
,
'Group 20'
)]
self
.
user_partition
=
UserPartition
(
...
...
@@ -152,6 +153,30 @@ class TestCohortPartitionScheme(django.test.TestCase):
# scheme should now return nothing
self
.
assert_student_in_group
(
None
)
def
test_student_lazily_assigned
(
self
):
"""
Test that the lazy assignment of students to cohorts works
properly when accessed via the CohortPartitionScheme.
"""
# don't assign the student to any cohort initially
self
.
assert_student_in_group
(
None
)
# get the default cohort, which is automatically created
# during the `get_course_cohorts` API call if it doesn't yet exist
cohort
=
get_course_cohorts
(
self
.
course
)[
0
]
# map that cohort to a group in our partition
self
.
link_cohort_partition_group
(
cohort
,
self
.
user_partition
,
self
.
groups
[
0
],
)
# The student will be lazily assigned to the default cohort
# when CohortPartitionScheme.get_group_for_user makes its internal
# call to cohorts.get_cohort.
self
.
assert_student_in_group
(
self
.
groups
[
0
])
def
setup_student_in_group_0
(
self
):
"""
Utility to set up a cohort, add our student to the cohort, and link
...
...
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