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
183f2f82
Commit
183f2f82
authored
Sep 10, 2015
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! split_test, user_partitions.
parent
57ed7983
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
53 deletions
+20
-53
lms/djangoapps/course_blocks/transformers/helpers.py
+0
-5
lms/djangoapps/course_blocks/transformers/tests/test_helpers.py
+2
-3
lms/djangoapps/course_blocks/transformers/tests/test_library_content.py
+2
-6
lms/djangoapps/course_blocks/transformers/tests/test_split_test.py
+14
-33
lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
+2
-6
No files found.
lms/djangoapps/course_blocks/transformers/helpers.py
View file @
183f2f82
"""
Transformers helpers functions.
"""
from
openedx.core.djangoapps.user_api.partition_schemes
import
RandomUserPartitionScheme
from
openedx.core.djangoapps.course_groups.partition_scheme
import
CohortPartitionScheme
SCHEME_SUPPORTS_ASSIGNMENT
=
[
RandomUserPartitionScheme
,
]
def
get_user_partition_groups
(
course_key
,
user_partitions
,
user
):
...
...
@@ -28,7 +24,6 @@ def get_user_partition_groups(course_key, user_partitions, user):
course_key
,
user
,
partition
,
**
({
'assign'
:
False
}
if
partition
.
scheme
in
SCHEME_SUPPORTS_ASSIGNMENT
else
{})
)
if
group
is
not
None
:
partition_groups
[
partition
.
id
]
=
group
...
...
lms/djangoapps/course_blocks/transformers/tests/test_helpers.py
View file @
183f2f82
...
...
@@ -97,10 +97,9 @@ class CourseStructureTestCase(ModuleStoreTestCase):
xblocks
=
(
self
.
blocks
[
ref
]
for
ref
in
refs
)
return
set
([
xblock
.
location
for
xblock
in
xblocks
])
def
assert_
course_structure_staff_user
(
self
,
staff
,
course
,
blocks
,
transformer
):
def
assert_
staff_access_to_all_blocks
(
self
,
staff
,
course
,
blocks
,
transformer
):
"""
Assert course structure integrity if block structure has transformer applied
and is viewed by staff user.
Assert staff users have access to all blocks
"""
raw_block_structure
=
get_course_blocks
(
staff
,
...
...
lms/djangoapps/course_blocks/transformers/tests/test_library_content.py
View file @
183f2f82
...
...
@@ -155,9 +155,5 @@ class ContentLibraryTransformerTestCase(CourseStructureTestCase):
)
)
def
test_course_structure_with_staff_user
(
self
):
"""
Test course structure integrity if block structure has transformer applied
and is viewed by staff user.
"""
self
.
assert_course_structure_staff_user
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
def
test_staff_user
(
self
):
self
.
assert_staff_access_to_all_blocks
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
lms/djangoapps/course_blocks/transformers/tests/test_split_test.py
View file @
183f2f82
...
...
@@ -118,38 +118,14 @@ class SplitTestTransformerTestCase(CourseStructureTestCase):
]
}
def
test_user_not_assigned
(
self
):
"""
Test when user is not assigned to any group in user partition.
"""
trans_block_structure
=
get_course_blocks
(
self
.
user
,
self
.
course
.
location
,
transformers
=
{
self
.
transformer
}
)
self
.
assertEqual
(
set
(
trans_block_structure
.
get_block_keys
()),
self
.
get_block_key_set
(
'course'
,
'chapter1'
,
'lesson1'
,
'vertical1'
,
'split_test1'
)
)
def
test_user_assigned
(
self
):
"""
Test when user is assigned to any group in user partition.
"""
# Add user to split test.
self
.
split_test_user_partition
.
scheme
.
get_group_for_user
(
CourseKey
.
from_string
(
unicode
(
self
.
course
.
id
)),
self
.
user
,
self
.
split_test_user_partition
,
)
def
test_user
(
self
):
trans_block_structure
=
get_course_blocks
(
self
.
user
,
self
.
course
.
location
,
transformers
=
{
self
.
transformer
}
transformers
=
{
self
.
transformer
}
,
)
# user was randomly assigned to one of the groups
user_groups
=
get_user_partition_groups
(
self
.
course
.
id
,
[
self
.
split_test_user_partition
],
self
.
user
)
...
...
@@ -164,9 +140,14 @@ class SplitTestTransformerTestCase(CourseStructureTestCase):
self
.
assertEqual
(
set
(
trans_block_structure
.
get_block_keys
()),
set
(
self
.
get_block_key_set
(
*
expected_blocks
)))
def
test_course_structure_with_staff_user
(
self
):
"""
Test course structure integrity if block structure has transformer applied
and is viewed by staff user.
"""
self
.
assert_course_structure_staff_user
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
# calling again should result in the same block set
reloaded_structure
=
get_course_blocks
(
self
.
user
,
self
.
course
.
location
,
transformers
=
{
self
.
transformer
}
)
self
.
assertEqual
(
set
(
reloaded_structure
.
get_block_keys
()),
set
(
self
.
get_block_key_set
(
*
expected_blocks
)))
def
test_staff_user
(
self
):
self
.
assert_staff_access_to_all_blocks
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
lms/djangoapps/course_blocks/transformers/tests/test_user_partitions.py
View file @
183f2f82
...
...
@@ -122,9 +122,5 @@ class UserPartitionTransformerTestCase(CourseStructureTestCase):
self
.
get_block_key_set
(
'course'
,
'chapter1'
,
'lesson1'
,
'vertical1'
,
'html2'
)
)
def
test_course_structure_with_staff_user
(
self
):
"""
Test course structure integrity if block structure has transformer applied
and is viewed by staff user.
"""
self
.
assert_course_structure_staff_user
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
def
test_staff_user
(
self
):
self
.
assert_staff_access_to_all_blocks
(
self
.
staff
,
self
.
course
,
self
.
blocks
,
self
.
transformer
)
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