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
3559bd1e
Commit
3559bd1e
authored
Feb 15, 2016
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor test to check support for both modulestore and is_self_paced method improvement
parent
df0b983e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
cms/djangoapps/contentstore/utils.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_item.py
+22
-18
No files found.
cms/djangoapps/contentstore/utils.py
View file @
3559bd1e
...
...
@@ -463,4 +463,4 @@ def is_self_paced(course):
"""
Returns True if course is self-paced, False otherwise.
"""
return
course
.
self_paced
and
SelfPacedConfiguration
.
current
()
.
enabled
if
course
else
False
return
course
and
course
.
self_paced
and
SelfPacedConfiguration
.
current
()
.
enabled
cms/djangoapps/contentstore/views/tests/test_item.py
View file @
3559bd1e
...
...
@@ -1848,6 +1848,7 @@ class TestLibraryXBlockCreation(ItemTest):
self
.
assertFalse
(
lib
.
children
)
@ddt.ddt
class
TestXBlockPublishingInfo
(
ItemTest
):
"""
Unit tests for XBlock's outline handling.
...
...
@@ -2171,7 +2172,8 @@ class TestXBlockPublishingInfo(ItemTest):
self
.
_verify_has_staff_only_message
(
xblock_info
,
True
,
path
=
self
.
FIRST_SUBSECTION_PATH
)
self
.
_verify_has_staff_only_message
(
xblock_info
,
True
,
path
=
self
.
FIRST_UNIT_PATH
)
def
test_self_paced_item_visibility_state
(
self
):
@ddt.data
(
ModuleStoreEnum
.
Type
.
mongo
,
ModuleStoreEnum
.
Type
.
split
)
def
test_self_paced_item_visibility_state
(
self
,
store_type
):
"""
Test that in self-paced course, item has `live` visibility state.
Test that when item was initially in `scheduled` state in instructor mode, change course pacing to self-paced,
...
...
@@ -2179,20 +2181,22 @@ class TestXBlockPublishingInfo(ItemTest):
"""
SelfPacedConfiguration
(
enabled
=
True
)
.
save
()
# Create chapter and setup future release date to make chapter in scheduled state
chapter
=
self
.
_create_child
(
self
.
course
,
'chapter'
,
"Test Chapter"
)
self
.
_set_release_date
(
chapter
.
location
,
datetime
.
now
(
UTC
)
+
timedelta
(
days
=
1
))
# Check that has scheduled state
xblock_info
=
self
.
_get_xblock_info
(
chapter
.
location
)
self
.
_verify_visibility_state
(
xblock_info
,
VisibilityState
.
ready
)
self
.
assertFalse
(
self
.
course
.
self_paced
)
# Change course pacing to self paced
self
.
course
.
self_paced
=
True
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
self
.
assertTrue
(
self
.
course
.
self_paced
)
# Check that in self paced course content has live state now
xblock_info
=
self
.
_get_xblock_info
(
chapter
.
location
)
self
.
_verify_visibility_state
(
xblock_info
,
VisibilityState
.
live
)
with
self
.
store
.
default_store
(
store_type
):
# Create course, chapter and setup future release date to make chapter in scheduled state
course
=
CourseFactory
.
create
()
chapter
=
self
.
_create_child
(
course
,
'chapter'
,
"Test Chapter"
)
self
.
_set_release_date
(
chapter
.
location
,
datetime
.
now
(
UTC
)
+
timedelta
(
days
=
1
))
# Check that has scheduled state
xblock_info
=
self
.
_get_xblock_info
(
chapter
.
location
)
self
.
_verify_visibility_state
(
xblock_info
,
VisibilityState
.
ready
)
self
.
assertFalse
(
course
.
self_paced
)
# Change course pacing to self paced
course
.
self_paced
=
True
self
.
store
.
update_item
(
course
,
self
.
user
.
id
)
self
.
assertTrue
(
course
.
self_paced
)
# Check that in self paced course content has live state now
xblock_info
=
self
.
_get_xblock_info
(
chapter
.
location
)
self
.
_verify_visibility_state
(
xblock_info
,
VisibilityState
.
live
)
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